* Deleting local image only if pict-rs client returned OK (fixes#5671)
* Adding validation of image, and making some refactoring
* fmt fix
* removed unnecessary validations
* Increase max query duration in PostView speed_check
* TypeScript type CommunityIdQuery for community icon/banner uploads (#5679)
Co-authored-by: Nutomic <me@nutomic.com>
* Add list of local user accounts for admins (fixes#4419) (#5668)
* Add list of local user accounts for admins (fixes#4419)
* add api route
* Merge list_banned_users into admin_list_users
* revert sql
* Optional columns are handled correctly in insert and update forms (ref #5672) (#5675)
* Optional columns are handled correctly in insert and update forms (ref #5672)
* Linter fix
* Downscale proxied thumbnails (fixes#5673) (#5674)
* Downscale proxied thumbnails (fixes#5673)
* add param
* fix tests
* Remove some api_common dependencies (ref #5642) (#5678)
* Adding validation of image, and making some refactoring
* fmt fix
* removed unnecessary validations
---------
Co-authored-by: aboitsov <anton.boitsov@zalando.fi>
Co-authored-by: Felix Ableitner <me@nutomic.com>
Co-authored-by: matc-pub <161147791+matc-pub@users.noreply.github.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
* Migrations before column fixes
* Change local_image to reference person_id, to track thumbnail creators.
- Fixes#5564
* Fixing API tests.
* Increase the post query duration time. #5661
* Adding thumbnail_and_post_id column
* Forgot ts-optional
* Fixing post spec tests.
* Try using promise.allSettled to ignore errors.
* Using consistent pictrs api key.
* Dont fetch thumbnails for user API.
* Dont delete thumbnails for user deletion.
* Dont filter out thumbnail images when fetching or deleting.
* Update crates/api_common/src/utils.rs
Co-authored-by: Richard Schwab <gitrichardschwab-7a2qxq42kj@central-intelligence.agency>
* Addressing PR comments
* Add comment.
* Rename to thumbnail_for_post_id
* Addressing PR comments
---------
Co-authored-by: Richard Schwab <gitrichardschwab-7a2qxq42kj@central-intelligence.agency>
* Fixing post_view largest community prefetch.
- Fixes#5621
* Cache the largest community result.
* Fixing community largest cache.
* Use cache duration
* Use 1-day cache for largest community
* Fix can_mod comparison with null and admin creator check
* Rename local user join helper
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
* created new table post_keyword_block related to a person and corresponding functions in diesel
* created corresponding api functions
* converted like to ilike in filter
* Fixxed errors for adding keywords for blocking posts
* Fixxed errors in diesel migrations
* Removed debug print
* #3710: Fixxed errors caused by cargo check
* #3710: added up and down scripts for diesel
* added tmp.schema to gitignore
* updated tests
* fixxed test
* fixxed error from rebasing
* Added max number of block tags and modified max length of block tags
* formatted code
* added migration to restrict block keyword length
* #3710: Added check if Blocked keyword is already existing
* #3710: Removed deprecated any
* #3710: Updated keyword length
* #3710: Fixxed errors from master merge
* #3710: Formatting
* #3710: Removed api to block keywords for post from v3 and changed of api path in v4
* #3710: Renamed post_keyword_block table to user_post_keyword_block and replaced id as primary key with the composed key person_id and keyword. Also now use update function which updates the blocked keywords for an user with a new list instead keyword by keyword.
* #3710: Formatted code
* #3710: Removed unnecessary parts for the block API in post as this will be done over the user settings
* #3710: Modified data structure for blocking keywords to reference local user and added update function which will update at all keywords for a local user at once
* #3710: Modified code so updating blocked keywords is now done over user settings
* #3710: Fixxed merging error
* #3710: Fixxed filter query
* #3710: Formatted Code
* #3710: Added suggested changes from review: keyword block update now does delete and then insert, postview uses read from LocalKeywordBlock, and validation with min_length_check and max_length_check
* #3710: formatted code
* c
* #3710: removed BlockKeywordForPost struct
* #3710: formatted code
* #3710: formatted code
* #3710: formatted code
* Adding admin image deletion endpoint.
- Also moving the list media endpoints, since these can go under a
common heading.
- Fixes#5563
* Changing list_all to list
* Fixing api tests.
* Delete all aliases.
* Fixing comment.
* Updating lemmy-js-client.
* Move db schema file to new crate
* db schema compiling
* wip
* db views
* compiling
* cleanup
* clippy
* fix path
* move some more files to new crate
* fixes
* fix
* fix
* Receive and store remote site bans (fixes#3399)
* db schema changes, handly expiration
* partial federation changes
* add column `mod_ban.instance_id`
* remove unused
* wip: remove person.banned
* fix down migration
* fmt, keep banned status
* fixes
* simplify
* update post removed
* fix api tests
* ban from local instance
* banned() helpers
* cleanup undo_block_user
* remove order by
* cache SiteView::read_local, add instance
* use local instance id for PersonView
* add helper function person_with_instance_actions
* use exists
* comments update removed
* remove method is_mod_or_admin
* fix tests
* no unwrap
* change local_instance_person_join
* remove LocalSite::read
* wip: home_instance_actions
* add home_instance_actions to all structs
* fixes
* fix tests
* fmt
* Starting to work on site person ban fixes.
* Starting to work on comment_view
* Adding a few more views.
* Cleaning up a few more views.
* Finishing up a few more.
* Fixing unit tests.
- Also fixes#5502
* Fixing merge 2.
* Adding a creator_banned field
---------
Co-authored-by: Felix Ableitner <me@nutomic.com>
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
* Allow sending report only to admins (fixes#2414)
* fix api test
* Rename `to_local_admins` to `violates_instance_rules`
* Review fixes
* fix api test