Skip to content

Conversation

@Nothing4You
Copy link
Collaborator

@Nothing4You Nothing4You commented Mar 29, 2025

This commit removes various cases in which Lemmy would purge images from pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias referring to removed content was deleted, all other aliases were invalidated as well.

Additionally, even alias deletion would not appropriate in many of these cases, as they were lacking validation that they were exclusively used by the content they were supposed to get removed with.

This implements the following changes:

  1. Purging a community no longer purges the community banner or icon from pict-rs.
  2. Purging a community no longer purges all images referenced in post URLs and post thumbnails within the community from pict-rs.
  3. Banning a user with content removal no longer purges their profile avatar or banner from pict-rs.
  4. Banning a user with content removal no longer purges images referenced in post URLs and post thumbnails for all posts they created from pict-rs.
  5. Banning a user with content removal no longer purges the community banners or icons for all communities they're the top mod of from pict-rs.
  6. Banning a user with content removal now deletes all media they uploaded.
  7. Purging a user no longer purges their profile avatar, banner, or images referenced in post URLs and post thumbnails for all posts they created from pict-rs. All media linked to their user account will still get deleted, which was already explicitly the case in the past.
  8. On an NSFW-disabled instance, receiving a post update via federation, which changes the post from not NSFW to NSFW no longer purges post URL and thumbnail from pict-rs.

Some of the mentioned actions will still remove references to image URLs from the database, such as purging a community will still set its icon and banner to NULL in the db, but the associated images will no longer be purged from pict-rs.

As this stops erasure of thumbnails, #5564 has been created to ensure tracking the person that triggered the creation of thumbnails, which will allow removing them like other images.

The only remaining option to purge images attached to a post is now purging an individual post, which still erases the post URL and thumbnail from pict-rs entirely, including any other aliases. Purging and banning users with content removal will remove all aliases associated with them, which will end up deleting those images entirely when there are no other alias remaining.

fixes #5560

Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
MrKaplan-lw pushed a commit to Fedihosting-Foundation-Forks/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 29, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
flamingos-cant pushed a commit to flamingos-cant/lemmy that referenced this pull request Mar 30, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
flamingos-cant added a commit to flamingos-cant/lemmy that referenced this pull request Mar 30, 2025
Also add the changes to from
LemmyNet#5565
related to handling NSFW posts from federation.
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 31, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 31, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as banning a user with content removal setting their avatar
and profile banner to `NULL` in the db, which prevents them from being
displayed on their profile.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging users will remove all aliases
associated with them, which will end up deleting those images entirely when
there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Banning a user with content removal now deletes all media they uploaded.
7. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.
8. On an NSFW-disabled instance, receiving a post update via federation, which
changes the post from not NSFW to NSFW no longer purges post URL and thumbnail
from pict-rs.

Some of the mentioned actions will still remove references to image URLs from
the database, such as purging a community will still set its icon and banner to
`NULL` in the db, but the associated images will no longer be purged from
pict-rs.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging and banning users with content
removal will remove all aliases associated with them, which will end up
deleting those images entirely when there are no other alias remaining.

fixes LemmyNet#5560
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Mar 31, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Banning a user with content removal now deletes all media they uploaded.
7. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as purging a community will still set its icon and banner to
`NULL` in the db, but the associated images will no longer be purged from
pict-rs.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging and banning users with content
removal will remove all aliases associated with them, which will end up
deleting those images entirely when there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx!

purge_post_images(url, thumbnail_url, context).await;
// TODO: Remove locally generated thumbnail if one exists, depends on
// https://github.com/LemmyNet/lemmy/issues/5564 to be implemented to be able to
// safely do this.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll comment in the linked issue.

@Nutomic Nutomic merged commit b892f3d into LemmyNet:main Apr 1, 2025
1 check passed
@Nothing4You Nothing4You deleted the pictrs-purges branch April 1, 2025 13:25
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Apr 1, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Banning a user with content removal now deletes all media they uploaded.
7. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as purging a community will still set its icon and banner to
`NULL` in the db, but the associated images will no longer be purged from
pict-rs.

As this stops erasure of thumbnails, LemmyNet#5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging and banning users with content
removal will remove all aliases associated with them, which will end up
deleting those images entirely when there are no other alias remaining.

backports LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@988638d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Apr 1, 2025
This change was implemented after the original PR was created to restore
functionality to delete user media on bans with content removal. Unlike the
original implementation, this now only deletes user media rather than purging
their images from pict-rs, and it applies to all uploads associated with the
user rather than iterating over media references in user avatar, user banner,
as well as post URLs and post thumbnails for all posts created by the banned
user.

backports remaining part of LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@b892f3d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Apr 1, 2025
This change was implemented after the original PR was created to restore
functionality to delete user media on bans with content removal. Unlike the
original implementation, this now only deletes user media rather than purging
their images from pict-rs, and it applies to all uploads associated with the
user rather than iterating over media references in user avatar, user banner,
as well as post URLs and post thumbnails for all posts created by the banned
user.

backports remaining part of LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@b892f3d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Apr 1, 2025
This change was implemented after the original PR was created to restore
functionality to delete user media on bans with content removal. Unlike the
original implementation, this now only deletes user media rather than purging
their images from pict-rs, and it applies to all uploads associated with the
user rather than iterating over media references in user avatar, user banner,
as well as post URLs and post thumbnails for all posts created by the banned
user.

backports remaining part of LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@b892f3d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Apr 1, 2025
This change was implemented after the original PR was created to restore
functionality to delete user media on bans with content removal. Unlike the
original implementation, this now only deletes user media rather than purging
their images from pict-rs, and it applies to all uploads associated with the
user rather than iterating over media references in user avatar, user banner,
as well as post URLs and post thumbnails for all posts created by the banned
user.

backports remaining part of LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@b892f3d
Nothing4You added a commit to Nothing4You/lemmy that referenced this pull request Apr 1, 2025
This change was implemented after the original PR was created to restore
functionality to delete user media on bans with content removal. Unlike the
original implementation, this now only deletes user media rather than purging
their images from pict-rs, and it applies to all uploads associated with the
user rather than iterating over media references in user avatar, user banner,
as well as post URLs and post thumbnails for all posts created by the banned
user.

backports remaining part of LemmyNet#5565 to 0.19

LemmyNet#5565
LemmyNet@b892f3d
Nutomic pushed a commit that referenced this pull request Apr 2, 2025
This commit removes various cases in which Lemmy would purge images from
pictrs, which would in many cases not be what admins intended.

pict-rs provides aliases on upload, which allows deduplicating multiple uploads
of the same file in the backend, while still providing unique URLs for uploads.

As Lemmy used pictrs' purge API, this meant that not only the image alias
referring to removed content was deleted, all other aliases were invalidated as
well.

Additionally, even alias deletion would not appropriate in many of these cases,
as they were lacking validation that they were exclusively used by the content
they were supposed to get removed with.

This implements the following changes:

1. Purging a community no longer purges the community banner or icon from
pict-rs.
2. Purging a community no longer purges all images referenced in post URLs and
post thumbnails within the community from pict-rs.
3. Banning a user with content removal no longer purges their profile avatar or
banner from pict-rs.
4. Banning a user with content removal no longer purges images referenced in
post URLs and post thumbnails for all posts they created from pict-rs.
5. Banning a user with content removal no longer purges the community banners
or icons for all communities they're the top mod of from pict-rs.
6. Banning a user with content removal now deletes all media they uploaded.
7. Purging a user no longer purges their profile avatar, banner, or images
referenced in post URLs and post thumbnails for all posts they created from
pict-rs. All media linked to their user account will still get deleted, which
was already explicitly the case in the past.

Some of the mentioned actions will still remove references to image URLs from
the database, such as purging a community will still set its icon and banner to
`NULL` in the db, but the associated images will no longer be purged from
pict-rs.

As this stops erasure of thumbnails, #5564 has been created to ensure tracking
the person that triggered the creation of thumbnails, which will allow removing
them like other images.

The only remaining option to purge images attached to a post is now purging an
individual post, which still erases the post URL and thumbnail from pict-rs
entirely, including any other aliases. Purging and banning users with content
removal will remove all aliases associated with them, which will end up
deleting those images entirely when there are no other alias remaining.

backports #5565 to 0.19

#5565
988638d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Banning users and removing content also removes images that they didn't upload.

3 participants