* Adding checks for higher admin and mod.
* Adding admin/mod checks for ban and comment removal.
* Combining mod or admin check with an SQL union.
* Making community ban or add mod also allow higher admins.
* Making sure remove post also checks higher mods or admins.
* Add unit test for is_higher_mod_or_admin_check
* Fixing comment.
* Addressing PR comments.
* Get rid of pointless wrapper functions, return lemmyresult directly.
* Fixing not being able to create comments on local community posts.
- This was caused by not passing my_person_id into various
`CommentView::read` functions.
- Fixes#4853
* Refactoring views to use local_user, rather than person
* Addressing PR comments.
* Fixing API tests.
* Allow empty string to clear URL-type DB fields.
- To address difficulties with clearing URL-type fields like
avatars, banners, site icons, this PR turns the URL type form
fields into strings.
- This allows an empty string to be used as a "clear data", as
in the case with the regular text form fields.
- Also includes various cleanups.
- Fixes#4777
- Context: #2287
* Fixing comment.
* Use Option<&str> and deref.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* Prevent bot replies from increasing unread reply count when bot accounts are not shown
* Pass LocalUser for unread replies count query
* Prevent bot mentions from increasing unread reply count when bot accounts are not shown
* After creating a comment, update the unread comments for the post.
- Fixes#3863
* Addressing PR comments.
* Add comment.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* Dont show replies / mentions from blocked users. Fixes#4227
* Adding unit tests for reply and mention views.
- Also cleaned up some unwraps in the tests.
* Add allow deprecated to pass clippy for deprecated wav crate.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* Mark database fields as sensitive so they dont show up in logs
* add file
* fix test
* Update crates/apub/src/objects/person.rs
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* Update crates/apub/src/objects/community.rs
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* Update crates/apub/src/objects/instance.rs
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
- Diesel ordinarily throws an error when no results are returned for a
single fetch, which is a bit confusing. This PR ensures that the
missing value cases are all caught, and wrapped with new LemmyErrors,
rather than diesel errors.
- Fixes#4601
* Delete a person's local images on delete account.
* Rename purge function to delete.
* Use purge_user_account instead of Person::delete_account in purge person.
* Fixing clippy
* Adding listMedia endpoint, to view all your local image uploads.
- Fixes#4445
* Fix ts import.
* Forgot to order by published desc
* Adding an endpoint to list all images, for admins only.
* Forgot to add file.
* Add additional test.
* Use better logic for no-limit version.
* Better call sites.
* Adding another test.
* Fix tests.
* Moving list_media to /account action.
* Addressing PR comments.
* Removing pointless comment.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* On registration, automatically set content languages from accept header
* no need to set site language or default language for new user anymore
* fix test
* fix langs
* avoid duplicate writing of new user languages
* Add a blocklist for URLs.
* Fix SQL format
* Make clippy happy.
* Use regex for URL matching.
* Escape regex chars in URLs.
* Use post for modification.
* Make URL block regex static and remove API routes.
* Add date fields to table and use transaction.
* Use Cache for blocklist.
* Rename check_links + move list to parameters of process_markdown.
* SQL format.
* Format, again.
* Remove println.
* Add API test.
* Set a shorter lifetime for regex in debug mode.
* Add missing macro.
* Update lemmy-js-client
* Update api_test/pnpm-lock.yaml
* Don't break other tests
* Use different URL for test
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Nutomic <me@nutomic.com>
* When banning a federated user, also remove their content from our local
communities.
- This works by:
- Before a site ban, find all posts and comments to local communities
- Send a federated community ban action for each local comm.
- This also removes their content in the apub receive code.
- Adding back in federated community ban api tests.
- Adding in two more api tests for site bans.
- Fixes#4118
* Add local community ban, and nonlocal person check.
* Ignoring errors.
* Move local check into function.
* Addressing PR comments 2
* Adding ability to hide posts.
- Adds an post/hide API route.
- Adds a `show_hidden` (default false) to `GetPosts`.
- Adds a `hidden` field to `PostView`.
- Removes the single `post_id` from MarkPostAsRead.
- Fixes#1403
* Add a check to make sure hidden field is true.
* Fixing test.
* Add back semicolon
* Expose LemmyErrorType in lemmy_api_common
* Make conditional compilation gates for utils
* Make it so api_common doesn't pull in unnecessary deps
* Make error type non exhaustive
* Fix formatting
* Format toml
* Add some convenience derives to LemmyError
* Simplify features
* Fix CI compile error
---------
Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
* Add markdown rule to add rel=nofollow for all links
* Add markdown image rule to add local image proxy (fixes#1036)
* comments
* rewrite markdown image links working
* add comment
* perform markdown image processing in api/apub receivers
* clippy
* add db table to validate proxied links
* rewrite link fields for avatar, banner etc
* sql fmt
* proxy links received over federation
* add config option
* undo post.url rewriting, move http route definition
* add tests
* proxy images through pictrs
* testing
* cleanup request.rs file
* more cleanup (fixes#2611)
* include url content type when sending post over apub (fixes#2611)
* store post url content type in db
* should be media_type
* get rid of cache_remote_thumbnails setting, instead automatically
take thumbnail from federation data if available.
* fix tests
* add setting disable_external_link_previews
* federate post url as image depending on mime type
* change setting again
* machete
* invert
* support custom emoji
* clippy
* update defaults
* add image proxy test, fix test
* fix test
* clippy
* revert accidental changes
* address review
* clippy
* Markdown link rule-dess (#4356)
* Extracting opengraph_data to its own type.
* A few additions for markdown-link-rule.
---------
Co-authored-by: Nutomic <me@nutomic.com>
* fix setting
* use enum for image proxy setting
* fix test configs
* add config backwards compat
* clippy
* machete
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
* Allow community mods to see votes in addition to admins
* Use Post instead of PostView
---------
Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
* Prevent crates that shouldn't be published from being published
* Make dependent crates publishable
* Make dependent crates publishable
* fix toml formatting
* Removing publish=true
* Removing versioned deps.
---------
Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>