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
this was originally removed in #5546, but #5515 introduced a new usage of it.
due to the order of PR merges this slipped through and broke the build on main.
fixes#5561
* Add plugin system (fixes#3562)
* loading changes
* Use golang for default plugin (faster to compile)
* add remaining pre hooks
* Add remaining plugin hooks
* clippy
* Dont crash if plugin folder cant be read
* add metadata to /api/v4/site
* use plugin pool
* fix api common
* move plugin code to separate repo
* remove dbg
* fix api tests
* Add private message hooks
* only load plugin for epsilon test instance
* 1s timeout
* load plugin over http
* no return value for pre hooks
* dont run plugin hook code if no plugins loaded
* make plugin calls async
* clippy
* spawn_blocking
* fix vote hooks, add lemmy_url
* update before hooks, vote hooks
* adjust post hooks
* rename functions
* expose lemmy version to plugins
* fix hooks
* fix again
* update plugin
* not mut
* clippy
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
* Add columns post.pending, comment.pending
* add comments
* rename migration
* helper method, set not pending on vote received
* rename to federation_pending, add comments
* fix down migration
* Register users in a transaction.
- Fixes#5477
* Removing transactions from language code.
* Replace build_transactions with async transactions.
* Forgot one transaction.
* Extracting pagination cursor utils into a trait.
- Fixes#5275
* Refactoring to avoid stack overflows.
* Fixing api_common feature.
* Adding pagination for GetBannedPersons.
- Must come after #5424
- Fixes#2847
* Rename the traits and paginationcursor::new
* Using combined trait.
* Removing empty files.
* Merge from main, limit fetch.
* Adding local ban check, and ignore_page_limits.
* Only do page limits if not admin.
* add routes
* implement some of api
* fix use of check_report_reason
* fix create_community_report
* fix all compile errors
* add field to reportcombined struct
* add CommunityReportView::read test
* import resolve_community_report
* remove references to deleted table
* resolve reports after remove
* Block NSFW content on instances with it disabled
* Make disallow_nsfw_content a local_site setting
* Clippy
* Add comma
* SQL fmt
* Newline
* Use func in apub + update js-client
* Remove extra db queries, add purge_post_images
* Add back local_site to funcs that need it
* Fix tests
* Add delay to api test
* Address comments
* Cleanup
* Return results from db func
* fmt
* Remove unneeded result
* Sync translations
* Add Alt-Text Filter to post_view.rs
Added Alt-text filter to search
* Actually use the Alt-text filter I added
Add the call to actually use the alt-text filter I added.
* Create down.sql of migration
* Create up.sql
* Fixing SQL format.
---------
Co-authored-by: Dessalines <tyhou13@gmx.com>
* Allow sending report only to admins (fixes#2414)
* fix api test
* Rename `to_local_admins` to `violates_instance_rules`
* Review fixes
* fix api test
* When verifying email, add note about waiting for approval.
- Fixes#5392
* Refactoring local user interface language.
* Removing rosetta from api common.
* Remove pointless Ok
* Add ability to resend verification email.
- Fixes#5191
* Forgot to commit file.
* Fixing bad merge.
* Using send_verification_email_if_required.
* When verifying email, add note about waiting for approval.
- Fixes#5392
* Refactoring local user interface language.
* Removing rosetta from api common.
* Remove pointless Ok
These platforms dont support privacy controls for votes, so they
will most likely leak the content of private communities as well.
Need to block them until support is implemented.
https://github.com/MbinOrg/mbin/issues/1115
* Adding a can_mod field to CommentView, PostView, and CommunityView.
- Also removes the moderators from GetPost, as that should no longer
be necessary.
- Fixes#4365
* Adding can_mod to reply variants.
* Addressing PR comments.
* Hiding comment.content for non-admins / mods.
- Uses the local_user_can_mod function now.
- Fixes#5232
* Adding listing_type filter for modlog.
- Fixes#4219
* Running fmt.
* Change the listing_type.all to not filter by community.
* Adding GetModlog API docs.
* Addressing PR comments 2
* Renaming person_mention to person_comment_mention.
* Finishing up post body mentions.
* Combined tables try 2
* Finishing up combined report table.
* Fix ts optionals.
* Adding tests, triggers, and history updates for report_combined.
* Adding profile.
* Add cursor pagination to report_combined view (#5244)
* add pagination cursor
* store timestamp instead of id in cursor (partial)
* Revert "store timestamp instead of id in cursor (partial)"
This reverts commit 89359dde4b.
* use paginated query builder
* Fixing migration and paged API.
* Using dullbananas trigger procedure
* Removing pointless list routes, reorganizing tests.
* Fixing column XOR check.
* Forgot to remove list report actions.
* Cleanup.
* Use internal tagging.
* Fixing api tests.
* Adding a few indexes.
* Fixing migration name.
* Fixing unique constraints.
* Addressing PR comments.
* Start working on profile combined
* Adding views and replaceable schema.
* A few changes to profile view.
- Separating the profile fetch from its combined content fetch.
- Starting to separate saved_only into its own combined view.
* Finishing up combined person_saved and person_content.
* Fixing api tests.
* Moving to api-v4 routes.
* Fixing imports.
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update migrations/2024-12-02-181601_add_report_combined_table/up.sql
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update migrations/2024-12-02-181601_add_report_combined_table/up.sql
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Fixing import and fmt.
* Fixing null types in postgres.
* Comment out err.
* Fixing TS issues.
* Adding types, fixing allow and blocklist crud.
* Starting to work on combined views.
* Using dullbananas trigger procedure
* Adding the full combined view queries.
* Adding tests.
* taplo fmt.
* Upgrading package.json deps.
* Updating pnpm
* Most of the bulk work done, need to add tests yet.
* Finishing up inbox.
* Using assert_length
* Fixing sql_format.
* Running fmt.
* Fixing cargo shear.
* Fixing clippy.
* Addressing PR comments.
* Starting to work on search combined.
* Fix
* Removing serialization
* Removing serialization
* Moving db_views_actor and _moderator into db_views.
- This is necessary because the combined views use both, and that
separation was arbitrary to begin with. db_schema has no such crate
separation.
* Adding search combined view, need to write tests yet.
* Filters done, working on tests.
* Adding tests for person, post, and community.
* Finishing up tests.
* Fixing duped trigger.
* Remove saved_only test.
* Remove pointless post_tags types.
* Remove pointless index.
* Changing published to saved for person_saved_combined.
* Removing comment.
* Renaming modlog when_ columns to published.
- Fixes#5312
* Adding strum and simplifying imports.
* Avoiding clone in map_to_enum
* Changing modded_person to other_person.
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Addressing PR comments.
* Fixing split.
* Revert "Adding strum and simplifying imports."
This reverts commit 15f1671107.
* Running fmt.
* Using assert + matches instead of filter_map.
* Adding listPersonContent check.
* Updating lemmy-js-client
* Fixing mark all as read route, changing mark read to SuccessResponse.
* Adding post body mention api test, fixing api tests.
* Fixing route locations, and api tests.
* Formatting sql.
* Formatting sql 2.
* Fixing search result, running clippy.
* Fixing ts_option.
* Adding search_combined.score column, and DB triggers.
* Fixing API tests.
* Adding an index for score.
* Using next_back instead of last.
* Converting local_user_view to use diesel auto_type.
* Use AllColumns as suggested by weiznich to simplify Type.
* Registration application view.
* Person view simplifying.
* Community view.
* Community moderator view.
* Community view.
* Community follower view.
* Community moderator view.
* Person view.
* Custom emoji view.
* Local image view.
* Removing strum from db_views.
* Update crates/db_schema/src/newtypes.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Adding an action_utils.
* Avoiding inner joins for up.sql
* Adding person_aggregates.published column.
* Remove unused private message view.
* Implementing Selectable for DB views, moving joins inside impl.
* Adding a few more.
* Fixing imports.
* fmt.
* Post view.
* Comment view.
* Inbox combined view.
* Modlog combined view.
* The rest of the combined tables.
* Finishing up.
* Fixing shear.
* Fixing cargo.toml.
* Use 1.81 image.
* Fix api common.
* Fixing merge issues.
---------
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Federete resolve report action (fixes#4744)
* working
* clippy and fixes
* fix test
* verify mod action
* add workaround for test
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
* Renaming person_mention to person_comment_mention.
* Finishing up post body mentions.
* Combined tables try 2
* Finishing up combined report table.
* Fix ts optionals.
* Adding tests, triggers, and history updates for report_combined.
* Adding profile.
* Add cursor pagination to report_combined view (#5244)
* add pagination cursor
* store timestamp instead of id in cursor (partial)
* Revert "store timestamp instead of id in cursor (partial)"
This reverts commit 89359dde4b.
* use paginated query builder
* Fixing migration and paged API.
* Using dullbananas trigger procedure
* Removing pointless list routes, reorganizing tests.
* Fixing column XOR check.
* Forgot to remove list report actions.
* Cleanup.
* Use internal tagging.
* Fixing api tests.
* Adding a few indexes.
* Fixing migration name.
* Fixing unique constraints.
* Addressing PR comments.
* Start working on profile combined
* Adding views and replaceable schema.
* A few changes to profile view.
- Separating the profile fetch from its combined content fetch.
- Starting to separate saved_only into its own combined view.
* Finishing up combined person_saved and person_content.
* Fixing api tests.
* Moving to api-v4 routes.
* Fixing imports.
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update migrations/2024-12-02-181601_add_report_combined_table/up.sql
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update migrations/2024-12-02-181601_add_report_combined_table/up.sql
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Fixing import and fmt.
* Fixing null types in postgres.
* Comment out err.
* Fixing TS issues.
* Adding types, fixing allow and blocklist crud.
* Starting to work on combined views.
* Using dullbananas trigger procedure
* Adding the full combined view queries.
* Adding tests.
* taplo fmt.
* Upgrading package.json deps.
* Updating pnpm
* Most of the bulk work done, need to add tests yet.
* Finishing up inbox.
* Using assert_length
* Fixing sql_format.
* Running fmt.
* Fixing cargo shear.
* Fixing clippy.
* Addressing PR comments.
* Starting to work on search combined.
* Fix
* Removing serialization
* Removing serialization
* Moving db_views_actor and _moderator into db_views.
- This is necessary because the combined views use both, and that
separation was arbitrary to begin with. db_schema has no such crate
separation.
* Adding search combined view, need to write tests yet.
* Filters done, working on tests.
* Adding tests for person, post, and community.
* Finishing up tests.
* Fixing duped trigger.
* Remove saved_only test.
* Remove pointless post_tags types.
* Remove pointless index.
* Changing published to saved for person_saved_combined.
* Removing comment.
* Renaming modlog when_ columns to published.
- Fixes#5312
* Adding strum and simplifying imports.
* Avoiding clone in map_to_enum
* Changing modded_person to other_person.
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Addressing PR comments.
* Fixing split.
* Revert "Adding strum and simplifying imports."
This reverts commit 15f1671107.
* Running fmt.
* Using assert + matches instead of filter_map.
* Adding listPersonContent check.
* Updating lemmy-js-client
* Fixing mark all as read route, changing mark read to SuccessResponse.
* Adding post body mention api test, fixing api tests.
* Fixing route locations, and api tests.
* Formatting sql.
* Formatting sql 2.
* Fixing search result, running clippy.
* Fixing ts_option.
* Adding search_combined.score column, and DB triggers.
* Fixing API tests.
* Adding an index for score.
* Update crates/db_schema/src/newtypes.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Avoiding inner joins for up.sql
* Adding person_aggregates.published column.
---------
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Adding post_id and type_ filters to combined reports.
- Added tests for these also.
- Some additional cleanup of the joins in reports_combined.
- Fixes#5265
* Adding period.
* Adding a slim comment_view variant, without post or community.
- Fixes#2957
* Alternate version.
* Only clone if check.
* Revert "Alternate version."
This reverts commit 64493959aa.
* Remove trait.