Commit graph

1606 commits

Author SHA1 Message Date
Richard Schwab
b892f3da59
remove unnecessary pictrs purge calls (#5565)
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
2025-04-01 10:33:08 +02:00
Nutomic
79f79a4e9a
Send out email after registration denied, email confirmed (fixes #5547) (#5553)
* Send out email after registration denied, email confirmed (fixes #5547)

* wip

* wip2

* all compiling

* cleanup

* move to subfolders

* update

* more fixes

* clippy

* remove line
2025-04-01 10:24:05 +02:00
Undearius
2298bdbce0
Refined slur_regex pattern (#5567)
Removed duplicate match group and adjusted the pattern to narrow the match closer to the naughty word.
2025-03-31 21:37:52 -04:00
Felix Ableitner
86382b9f55 Version 1.0.0-alpha.4 2025-03-31 09:48:57 +02:00
Richard Schwab
8b7b3ce072
fix removal of post.instance_id (#5562)
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
2025-03-31 09:44:55 +02:00
Nutomic
192344231c
Donation dialog changes (#5552)
* Remove disable_donation_dialog option

* Option to hide donation dialog permanently

* fix
2025-03-28 09:10:54 -04:00
Nutomic
636811eb8e
Receive and store remote site bans (fixes #3399) (#5515)
* 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

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-03-28 08:47:24 -04:00
Nutomic
e079a41308
Change private instance setting to allow federation (#5530) 2025-03-28 12:27:59 +01:00
Dessalines
0c78332881
Remove duped post.instance_id column. (#5546)
* Remove duped `post.instance_id` column.

- Fixes #5544

* Fix incorrect table ref.

* Fix diff check.

* Fix diff check 2.
2025-03-28 12:27:44 +01:00
Nutomic
a9c2fc77c8
Proxy post.url if it is an image (fixes #5538) (#5545)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-03-28 12:24:55 +01:00
Nutomic
4556a94387
Add plugin system (fixes #3562) (#5498)
* 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>
2025-03-28 10:54:02 +01:00
Nutomic
1743f21258
Remove hardcoded ratelimit (#5551)
* Remove hardcoded ratelimit

* needed for api tests
2025-03-26 12:27:33 -04:00
flamingos-cant
0c1d9c9350
Wrap attributedTo for group to fix Peertube federation (#5509)
* Wrap attributedTo for group to fix Peertube federation

* Combine AttributedTo

* Add func to truncate community description

* Fix endless recursion

* Add tests

* Cleaner wrapper for attributedTo

* Address comments
2025-03-26 12:49:19 +01:00
Nutomic
6aede48c1b
Add columns post.pending, comment.pending (#5499)
* 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
2025-03-25 11:43:25 +01:00
matc-pub
85c37e8edb
Return UploadImageResponse for avatar, banner and icon uploads (#5535) 2025-03-24 23:30:48 -04:00
Nutomic
401583b6ce
Change community outbox to use total post count (ref #5522) (#5524)
* Change community outbox to use total post count (ref #5522)

* fix
2025-03-24 17:06:13 -04:00
flamingos-cant
8e080e4926
Add backslahses to prevent image embeds breaking (#5506)
* Replace newlines with spaces in attachments

* Use backslash to prevent breaks instead

* fmt

* Split + join with spaces
2025-03-19 11:56:34 +01:00
dullbananas
3324003049
Fix error type returned by verify_person (#5519) 2025-03-18 10:09:54 -04:00
dullbananas
4c3a52e94c
Remove underscores that are no longer needed in impls/site.rs (#5507) 2025-03-15 13:11:52 -04:00
Nutomic
d78fe5fb1f
Community local removed (#5500)
* Better handling of local and remote bans (fixes #3399, ref #4571)

* rename migration

* basic code changes

* post/community pending

* revert person.local_banned

* ignore local_removed communities in queries

* fix test

* Add column `community.local_removed`

* fmt
2025-03-14 10:37:20 -04:00
Nutomic
fcd4bbe8e3
Add comment for database pool size memory size (#5503) 2025-03-14 09:53:45 -04:00
Nutomic
7daa1c6543
Document environment variable for database url (#5501) 2025-03-13 08:11:58 -04:00
Dessalines
5fa6a490d5
Create actions structs (#5482)
* migration

* update code

* tests

* triggers

* fix

* fmt

* clippy

* post aggregate migration

* changes for post aggregate code

* wip: update tests for post aggregate

* format

* fix partialeq

* trigger fix

* fix post insert trigger

* wip

* reorder

* fixes

* community aggregate migration

* update code

* triggers

* person aggregate migration

* person aggregate code

* person triggers

* test fixes

* fix scheduled task

* update api tests

* site_aggregates to local_site migration

* site_aggregates code changes

* triggers, tests

* more fixes

* Rename PersonPostAggregates to PostActions

* Merge local_user_vote_display_mode into local_user

* fix schema

* remove duplicate fields

* remove "aggregates" from index names

* uncomment indices

* if count = 0

* remove commentaggregates

* Fix triggers in remove aggregates tables pr (#5451)

* prevent all db_schema test errors

* fix the delete_comments_before_post problem in a way that doesn't affect the returned number of affected rows

* remove unnecessary recursion checks and add comment to remaining check

* clean up

* Fixing SQL format.

* Update triggers.sql

* Update triggers.sql

* Update triggers.sql

* Update triggers.sql

* remove update of deleted column

---------

Co-authored-by: Dessalines <tyhou13@gmx.com>

* rename migration

* Fix migration errors

* Move community.hidden to visibility (fixes #5458)

* Fixing person_saved_combined. (#5481)

* Remove comment and post specific action structs. #5473

* Doing reports

* fix up migration by dropping index

* also add enum variant `LocalOnlyPublic`, rename `LocalOnly` to `LocalOnlyPrivate`

fixes #5351

* fix column order in down.sql

* wip

* Moving blocks.

* Adding a few more views.

* more wip

* fixes

* migration for modlog

* fix migration

* Working views and schema.

* Fix ts_optionals.

* wip

* db_schema compiling

* make the code compile

* Merging from main.

* lint

* Fixing SQL format.

* fix down migration

* Fixing api tests.

* Adding field comments for the actions tables.

* Refactoring CommunityFollower to include follow_state

* fix test

* make hidden status federate

* ts attr

* fix

* fix api test

* Update crates/api/src/reports/post_report/resolve.rs

Co-authored-by: Nutomic <me@nutomic.com>

* Addressing PR comments

* Fix ts export.

* update api client

* review

* Extracting filter_not_hidden_or_is_subscribed (#5497)

* Extracting filter_not_hidden_or_is_subscribed

* Cleanup.

* Cleanup 2.

* Remove follower_state_helper function.

* Cleaning up some utils functions.

* rename hidden to unlisted

---------

Co-authored-by: Felix Ableitner <me@nutomic.com>
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
2025-03-12 11:51:34 -04:00
Nutomic
8ffeeca52d
Changes to community visibility (#5478)
* Move community.hidden to visibility (fixes #5458)

* fix up migration by dropping index

* also add enum variant `LocalOnlyPublic`, rename `LocalOnly` to `LocalOnlyPrivate`

fixes #5351

* fix column order in down.sql

* wip

* more wip

* fixes

* migration for modlog

* fix migration

* wip

* db_schema compiling

* make the code compile

* lint

* fix down migration

* fix test

* make hidden status federate

* ts attr

* fix

* fix api test

* update api client

* review

* Extracting filter_not_hidden_or_is_subscribed (#5497)

* Extracting filter_not_hidden_or_is_subscribed

* Cleanup.

* Cleanup 2.

* rename hidden to unlisted

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-03-12 09:45:02 -04:00
dullbananas
d93bfdd2fa
Update user count from local_user table instead of person table, and only count users with accepted application (#5495)
* Update user count from local_user instead of person, and only count users with accepted application

* fix

* Update up.sql

* Update down.sql
2025-03-11 16:37:40 +01:00
Nutomic
b6f46cd38c
When creating community copy allowed languages from creator profile (#5490) 2025-03-11 09:53:41 -04:00
Dessalines
bb82e5dd43
Register users in a transaction. (#5480)
* Register users in a transaction.

- Fixes #5477

* Removing transactions from language code.

* Replace build_transactions with async transactions.

* Forgot one transaction.
2025-03-11 10:39:48 +01:00
Dessalines
91d10092b6
Adding pagination for GetBannedPersons (#5428)
* 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.
2025-03-11 09:41:02 +01:00
Nutomic
96e4621cb8
Dont force enable undetermined language anymore (fixes #5487) (#5491)
* Dont force enable undetermined language anymore (fixes #5487)

* fix test
2025-03-10 11:52:35 -04:00
dullbananas
08defa29fe
Add community reports to API (#5435)
* 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
2025-03-10 09:37:50 -04:00
vaskebjoern
b8de9a518b
Added display of image files to post description. (#5488) 2025-03-07 21:29:55 -05:00
Nutomic
9a64902ace
Remove aggregate tables (fixes #4869) (#5407)
* migration

* update code

* tests

* triggers

* fix

* fmt

* clippy

* post aggregate migration

* changes for post aggregate code

* wip: update tests for post aggregate

* format

* fix partialeq

* trigger fix

* fix post insert trigger

* wip

* reorder

* fixes

* community aggregate migration

* update code

* triggers

* person aggregate migration

* person aggregate code

* person triggers

* test fixes

* fix scheduled task

* update api tests

* site_aggregates to local_site migration

* site_aggregates code changes

* triggers, tests

* more fixes

* Rename PersonPostAggregates to PostActions

* Merge local_user_vote_display_mode into local_user

* fix schema

* remove duplicate fields

* remove "aggregates" from index names

* uncomment indices

* if count = 0

* remove commentaggregates

* Fix triggers in remove aggregates tables pr (#5451)

* prevent all db_schema test errors

* fix the delete_comments_before_post problem in a way that doesn't affect the returned number of affected rows

* remove unnecessary recursion checks and add comment to remaining check

* clean up

* Fixing SQL format.

* Update triggers.sql

* Update triggers.sql

* Update triggers.sql

* Update triggers.sql

* remove update of deleted column

---------

Co-authored-by: Dessalines <tyhou13@gmx.com>

* rename migration

* Fix migration errors

* Fixing person_saved_combined. (#5481)

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-03-06 16:18:41 +01:00
Nutomic
7b86307760
Ignore accept-language header if not site languages are specified (#5485) 2025-03-06 09:34:20 -05:00
Nutomic
b14c6ae0ee
Add more options for image uploads (#5483)
* Add more options for image uploads

* remove separate option for animations

* add comment
2025-03-06 04:44:52 -05:00
Nutomic
1e02dea397
Use connection url to configure email (fixes #5472) (#5476)
* Use connection url for configure email (fixes #5472)

* clippy
2025-03-04 13:50:19 -05:00
Dessalines
a6507c169d
Extracting pagination cursor utils into a trait. (#5424)
* Extracting pagination cursor utils into a trait.

- Fixes #5275

* Refactoring to avoid stack overflows.

* Fixing api_common feature.

* Rename the traits and paginationcursor::new

* Using combined trait.

* Removing empty files.
2025-03-04 13:00:18 -05:00
flamingos-cant
2f2f58da65
Add HTML classes to mention (#5475) 2025-03-04 09:31:44 -05:00
Nutomic
62fb03599a
Use version from git to indicate unreleased changes (#5470) 2025-03-03 10:55:33 -05:00
Nutomic
97772b9553
Add config option to enable json logging (#5471) 2025-03-03 10:51:28 -05:00
flamingos-cant
e7ab5256f7
Add new setting to block NSFW content (#5436)
* 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
2025-03-03 11:46:39 +01:00
Nutomic
359942272a
Get rid of Option<Vec<_>> in api structs (fixes #2820) (#5463)
* Get rid of `Option<Vec<_>>` in api structs (fixes #2820)

* update js client

* only responses
2025-02-28 10:07:07 -05:00
Felix Ableitner
cd1da33fa1 Version 1.0.0-alpha.2 2025-02-28 14:33:44 +01:00
Felix Ableitner
0ad8466f06 Version 1.0.0-alpha.1 2025-02-28 14:18:28 +01:00
Nutomic
a3a988655d
Fix federation of unban action (fixes #5454) (#5456)
* Fix federation of unban action (fixes #5454)

* remove log
2025-02-28 08:09:19 -05:00
Nutomic
6e3355f941
Also search url field by default (#5459) 2025-02-28 08:08:55 -05:00
Draconic NEO
1a299ba628
Include image alt text in post search (#5449)
* 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>
2025-02-25 13:28:15 -05:00
Nutomic
493734d1b3
Show posts/comments from followed communities despite instance block (#5437)
* Show posts/comments from followed communities despite instance block (fixes #4303)

* move to utils
2025-02-20 17:18:38 -05:00
Nutomic
544a4cc039
Simplify slur regex (#5442)
* Simplify logic for slur regex

* Fix tests

* clippy

* fix test

* cache regex

* longer cache duration
2025-02-20 12:47:18 -05:00
Nutomic
510b0db869
Deleted user shouldnt break federation outbox (fixes #5441) (#5443)
* Deleted user shouldnt break federation outbox (fixes #5441)

* clippy
2025-02-20 12:46:36 -05:00
Dessalines
7f0ef4d7f4
Fix matrix id import. #5063 (#5440) 2025-02-20 09:29:07 +01:00
Nutomic
a65d4034d8
Reduce usage of async_trait (#5438)
* Reduce usage of async_trait

* use trait

* move dep
2025-02-19 11:06:22 -05:00
Dessalines
806f541fe5
Add ability to view your own sent reports. (#5427)
- Fixes #5108
2025-02-16 11:32:29 -05:00
Dessalines
a4bf28e123
Use rust:1.81 for CI. (#5423)
* Use rust:1.81 for CI.

- Should speed up CI jobs a lot, due to the diesel issues with 1.82+.

* Upgrading deps.
2025-02-13 09:51:42 +01:00
Nutomic
0e87900953
Allow sending report only to admins (fixes #2414) (#5350)
* Allow sending report only to admins (fixes #2414)

* fix api test

* Rename `to_local_admins` to `violates_instance_rules`

* Review fixes

* fix api test
2025-02-12 16:34:43 +01:00
Dessalines
ae9c735e90
Adding ability to resend verification email. (#5420)
* 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.
2025-02-12 10:21:34 -05:00
Dessalines
189491d1ca
Show comments for hidden communities. (#5417)
- Fixes #5390
2025-02-12 08:05:14 -05:00
Dessalines
c71e2a2195
When verifying email, add note about waiting for approval. (#5419)
* When verifying email, add note about waiting for approval.

- Fixes #5392

* Refactoring local user interface language.

* Removing rosetta from api common.

* Remove pointless Ok
2025-02-12 07:45:25 -05:00
Nutomic
0af973c3a2
Also remove private messages when banning user with "remove content" (#5414)
* Also remove private messages when banning user with "remove content"

* add private message removed

* fix formatting
2025-02-12 07:45:07 -05:00
Nutomic
7c7e482936
Ignore follow requests from kbin, mbin for private communities (#5416)
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
2025-02-11 10:24:10 -05:00
Dessalines
91a77ae456
Adding a can_mod field to CommentView, PostView, and CommunityView. (#5398)
* 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
2025-02-11 12:09:27 +01:00
Dessalines
426684d90f
Adding blurhash to image_details. (#5227)
* Adding blurhash to image_details.

- Fixes #5142

* Using new pictrs to get blurhash.

* Fixing ts-binding.

* Addressing PR comments.

* Commenting checks.

* Switching back to rust 1.81.

* Adding diesel schema

* Adding database user creation.

* Specific tests.

* Upping pictrs to 0.5.17-pre.9

* Fixing

* Using full tests.

* Fixing pictrs hash.

* Upgrading pnpm deps.
2025-02-10 17:27:22 -05:00
Dessalines
16ba42c152
Adding a variable time_range_limit, rather than having many post sorts like TopSixHours (#5403)
* Adding a variable time_range_seconds. #4340

* Adding default_post_time_range_seconds columns to local_user and site.

* Fixing ts-bindings.

* Fixing API comments.

* Update crates/db_schema/src/utils.rs

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* Add zero means override, to list_posts default time range.

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>
2025-02-10 22:41:20 +01:00
Dessalines
d8a4fd6125
Adding listing_type filter for modlog. (#5399)
* 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
2025-02-07 12:53:15 -05:00
Nutomic
496ae58cb6
Enable emails in Chinese (#5400) 2025-02-07 11:44:41 -05:00
Nutomic
b92853824f
Cors policy should allow any origin by default (fixes #5405) (#5406) 2025-02-07 11:11:44 -05:00
Nutomic
ba7d4bd117
Merge functions for formatting local urls (#5394)
* Merge functions for formatting local urls

* move methods to db structs

* typo
2025-02-07 11:11:16 -05:00
Dessalines
f0b00ccf94
Fixing a few view's saved columns to use the optional datetime. (#5402)
- Also adds some comments for them, since its a nullable string
  in the generated types.
2025-02-07 07:51:32 -05:00
Nutomic
865f0734ba
Fix crash while rewriting markdown (fixes #5380) (#5395)
* Special characters in markdown links (ref #5380)

* fix (fixes #5380)

* fix test
2025-02-06 08:00:36 -05:00
Nutomic
20fa90a23c
Rename actor_id columns to ap_id (#5393)
* Rename actor_id columns to ap_id

* update api tests

* fix

* lint
2025-02-05 22:56:37 -05:00
Felix Ableitner
1edc9f922d Version 1.0.0-alpha.0 2025-02-05 15:19:27 +01:00
Nutomic
ebb211e7ad
Improve email notification text (by @timothyhay256) (#5383)
* Improve email notification text

* fix translations

* Add markdown-it-footnotes (#5303)

* Remove unused param Create/EditSite.enable_nsfw

* Remove unnecessary Cargo.toml entry (#5279)

* Running cargo-wizard to speed up compilation times.

* Fix 1.

* Fix 2

* Removing panic abort, and config.toml file.

* Add custom migration runner, forbid some `diesel migration` commands, fix old migrations (#4673)

* Update schema.rs

* rename

* stuff

* finish new implementation of schema_setup::run (not including revert, test, etc.)

* fmt

* refactor

* fix sql

* migriation run command

* use trigger on migrations table

* add Options with disable_migrations field for test

* rename to enable_forbid_diesel_cli_trigger

* fix

* fix merge

* diff_checker (partial)

* Revert "diff_checker (partial)"

This reverts commit 6709882e14.

* Revert "Revert "diff_checker (partial)""

This reverts commit d4bdda5d11.

* diff check

* improve schema diff

* timestamp replacement

* ignore column order

* remove fedi_name default

* stuff

* improve diff

* stuff

* attempt parallel pg_dump

* attempt 2

* Revert "attempt 2"

This reverts commit a909d2d643.

* Revert "attempt parallel pg_dump"

This reverts commit 592a127954.

* improve diff check

* finish fixing migrations

* stuff

* use advisory lock

* stuff

* Update lib.rs

* fmt

* fmt

* clippy

* Update diff_check.rs

* Update .woodpecker.yml

* Update lib.rs

* Update lib.rs

* Update lib.rs

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update lib.rs

* re-run ci

* fmt

* fmt

* Update .woodpecker.yml

* Update .woodpecker.yml

* create separate database in ci

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* try to fix env var

* Update diff_check.rs

* Remove condition that's not needed anymore

* clippy

* exclude views and fast tables

* revert some migration changes

* fix

* fmt

* re-attempt checking character after skipped trigger name, and make code less confusing

* fmt

* fix

* rerun ci

* rerun ci

* fix strip_prefix order

* fix weird big Cargo.lock change by running `git checkout upstream/main Cargo.lock` then letting it auto update again

* fix

* remove installation commands that were removed in main branch

* Revert "remove installation commands that were removed in main branch"

This reverts commit fd65234a76.

* move create_database_user woodpecker step to make diff less weird

* fix clippy

* Make diff check work just like before

* Move new migrations to the end

* Revert changes to old migrations

* don't assume that migrations are already sorted

* retry CI

* fix merge

* find migrations dir in debug mode using CARGO_MANIFEST_DIR variable instead of current working directory

* always use embedded migrations

* improve doc comments for migration subcommand

* clippy fix

* move cfg(test) attribute to diff_check.rs

* copy `o` variable instead of calling `o` function

* use chrono::TimeDelta Display implementation to show migration duration

* Remove unused params on CreateSite/EditSite (#5311)

* Automatically marking posts created in an NSFW community as NSFW. (#5310)

* Automatically marking posts created in an NSFW community as NSFW.

- Context: https://github.com/LemmyNet/lemmy-ui/issues/2885

* Update crates/api_crud/src/post/create.rs

Co-authored-by: Nutomic <me@nutomic.com>

---------

Co-authored-by: Nutomic <me@nutomic.com>

* Correct HTTP status for NotFound error (fixes #5309) (#5313)

* Fix incorrectly using delete instead of uplete in update_banned_when_expired (#5316)

* Remove unused apub audience field (fixes #5278) (#5315)

* Remove unused apub audience field (fixes #5278)

* fix

* fix test

* remove comments

* Change default image_mode to proxy, remove deprecated option (#5176)

* Change default image_mode to proxy, remove deprecated option

* fix api test

* Add community reports (only the database part) (#4996)

* database stuff, not including tests

* change migration date

* fix community_report_view

* update stuff related to report_combined

* add db_schema/src/impls/community_report.rs

* add report counts to community_aggregates

* fix community_report columns and update report_combined_view::tests::test_combined

* add column for original sidebar; use None instead of clone; add report_combined_view::tests::test_community_reports

* use ts(optional) in CommunityReportView

* remove CommunityReportView::read

* Correctly paginate PostView when read_only is enabled (#5320)

* Image api rework (#5260)

* Split image endpoints into API v3 and v4

* Move into subfolders

* Upload avatar endpoint and other changes

* Various other changes

fixes #1772
fixes #4001

* clippy

* config options

* fix ts bindings

* fix api tests

* Add option to disable image upload (fixes #1118)

* split files into upload, download

* move sitemap to top level, not in api

* simplify code

* add upload user banner

* community icon/banner

* site icon/banner

* update js client

* wip

* add delete endpoints

* change comment

* optimization

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* move fn

* 1024px banner

* dont use static client

* fix api tests

* shear

* proxy pictrs in request.rs (fixes #5270)

* clippy

* try to fix api tests

* skip api tests

* create user

* debug

* dbg

* test

* image

* run another

* fixed?

* clippy

* fix

* fix health check

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* Optimize migrations (#5301)

* Optimize migrations

* update smoosh migration

---------

Co-authored-by: Dessalines <tyhou13@gmx.com>

* Adding Combined modlog (#5253)

* 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

* Addressing PR comments.

* Removing serialization

* Removing serialization

* 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.

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* Fixing person_content_combined migration uniques. (#5324)

* Upgrading deps. (#5326)

* Upgrading deps.

* Upgrading a few more.

* A few more

* Pictrs delete token (#5317)

* Split image endpoints into API v3 and v4

* Move into subfolders

* Upload avatar endpoint and other changes

* Various other changes

fixes #1772
fixes #4001

* clippy

* config options

* fix ts bindings

* fix api tests

* Add option to disable image upload (fixes #1118)

* split files into upload, download

* move sitemap to top level, not in api

* simplify code

* add upload user banner

* community icon/banner

* site icon/banner

* update js client

* wip

* add delete endpoints

* change comment

* optimization

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* move fn

* 1024px banner

* dont use static client

* fix api tests

* shear

* proxy pictrs in request.rs (fixes #5270)

* clippy

* Get rid of pictrs delete token

* remove delete token params

* try to fix api tests

* fmt

* skip api tests

* clippy

* create user

* debug

* dbg

* ignore test

* test

* image

* run another

* fixed?

* clippy

* fix

* migration with column order

* drop default

* fix health check

* update client

* remove unused

* fix

* reuse delete_image_from_pictrs

* update lib

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* Adding combined inbox (#5257)

* 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.

* Removing serialization

* Removing serialization

* 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.

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>

* Add media filter setting (#5325)

* Add hide_media filter

* Test media is returned when hide_media is false

* Add GIN index

* SQL fmt

* Drop GIN index in migration

* Changes to get_random_community_id: add filters for nsfw and private, use algorthm that doesn't scan the entire table (#5267)

* get_random_community_id: add filters for nsfw and private, use algorithm that doesn't scan the entire table

* only call random_smallint once for filter

* change migration date

* make random_smallint function work in postgresql 16

* replace "32768 + 32767 + 1" with "65536" and improve comments

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>

* Add support for donation dialog (fixes #4856) (#5318)

* Add support for donation dialog (fixes #4856)

* more changes

* test

* remove files

* default value for new user last_donation_notification

* move disable_donation_dialog to local_site

* restore formatting

* Clean up LemmyError::status_code (#5330)

* Return correct status code for rate limit error (ref #5332) (#5333)

* Upgrading html2text. (#5336)

* Prevent incorrectly using delete instead of uplete (#5331)

* implement check and test it by modifying PostLike::remove

* revert change in PostLike::remove

* Implement request idempotency (fixes #4735) (#5329)

* Implement request idempotency (fixes #4735)

* delete old items

* clippy

* remove todo

* Skip api test for community follower count (fixes #5179) (#5339)

* Change federation community restricted check to apply only locally (#5343)

* Revert "Fetch community mods synchronously (#5169)"

This reverts commit 542e59bcae.

* change restricted check (fixes #5337)

* Send federated reports to all community mods (#5342)

* Move middleware code into api_routes for faster compilation (#5341)

* Move middleware code into api_routes for faster compilation

* fix wasm

* cleanup

* Hash check and retry for pictrs binary (#5345)

* Hash check and retry for pictrs binary

* retry limit

* Adding a slim comment_view variant, without post or community. (#5335)

* 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.

* Change println! to debug! (#5346)

* Adding post_id and type_ filters to combined reports. (#5348)

* 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.

* Allow setting multiple values for cors_origin (fixes #5198) (#5353)

* Allow setting multiple values for cors_origin (fixes #5198)

* fmt

* mention env var

* Search combined (#5271)

* 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>

* Add some url validation (#5338)

* Add some url validation

* use library fn

* manually follow redirects

* remove log

* avoid infinite redirect/infinite recursion

* fix

* upgrade lib

* check url scheme

* Only list local banned users (fixes #2961) (#5364)

* Remove instrument macros (#5368)

* Remove instrument macros

* shear

* revert test change

* clippy, another unused function

* Remove unused files (#5366)

* Deny unknown config fields (#5370)

* Only print migration output when running migrate command (#5363)

* Revert "Change println! to debug! (#5346)"

This reverts commit 8ee81a3967.

* Using a custom print command.

* Fix missing word in create_triggers comment (#5375)

* Adding listing_type.ModeratorView for list communities. (#5377)

- Fixes #5352

* Use different counts for denominator in scaled rank for posts (#5261)

* Change 'Scaled' sort to use total interactions instead of monthly users

* Misc SQL fixes

* Fix formatting of error message

* Run rustfmt

* Using different corepack install method to fix corepack bug. (#5379)

- https://github.com/nodejs/corepack/issues/612

* Federate "resolve report" action (#5367)

* 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>

* Use mimalloc as memory allocator (#5378)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>

* Converting joins, filters, and selects to common functions for DB views. (#5359)

* 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>

* Version 0.20.0-alpha.0

* lint

* fix braces

---------

Co-authored-by: James Hoffman <purpledungeoncrab@protonmail.com>
Co-authored-by: flamingos-cant <45780476+flamingo-cant-draw@users.noreply.github.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
Co-authored-by: andrewmoise <andrew.moise@gmail.com>
2025-02-05 08:53:40 -05:00
Nutomic
e31823171c
Include saved date in api responses (fixes #5184) (#5384)
* Include saved date in api responses (fixes #5184)

* ts optional attr
2025-02-04 10:14:37 -05:00
Dessalines
d80ed5c0b7 Revert "Version 0.20.0-alpha.2"
This reverts commit 847ccc8dc6.
2025-02-04 09:44:44 -05:00
Dessalines
847ccc8dc6 Version 0.20.0-alpha.2 2025-02-04 09:25:12 -05:00
Nutomic
ebca30fdd8
Fix peertube federation (ref #3837) (#5381) 2025-02-04 08:15:46 -05:00
Nutomic
817a904644
Fix lint error due to translation update (#5382) 2025-02-04 11:39:04 +01:00
Dessalines
8cab63ee2c Version 0.20.0-alpha.0 2025-02-03 20:13:39 -05:00
Dessalines
e654462405
Converting joins, filters, and selects to common functions for DB views. (#5359)
* 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>
2025-02-03 19:47:48 -05:00
Nutomic
5fcf166a89
Federate "resolve report" action (#5367)
* 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>
2025-02-03 18:52:22 -05:00
andrewmoise
5240576de8
Use different counts for denominator in scaled rank for posts (#5261)
* Change 'Scaled' sort to use total interactions instead of monthly users

* Misc SQL fixes

* Fix formatting of error message

* Run rustfmt
2025-02-03 16:23:00 -05:00
Dessalines
8f73c10e01
Adding listing_type.ModeratorView for list communities. (#5377)
- Fixes #5352
2025-02-01 22:31:52 -05:00
dullbananas
182f2532dc
Fix missing word in create_triggers comment (#5375) 2025-02-01 13:27:47 -05:00
Dessalines
c0e156dfa7
Only print migration output when running migrate command (#5363)
* Revert "Change println! to debug! (#5346)"

This reverts commit 8ee81a3967.

* Using a custom print command.
2025-01-29 13:51:23 -05:00
Nutomic
2847040b3f
Deny unknown config fields (#5370) 2025-01-29 13:51:10 -05:00
Nutomic
fb825843dd
Remove unused files (#5366) 2025-01-29 13:50:41 -05:00
Nutomic
f3f1ea0e9e
Remove instrument macros (#5368)
* Remove instrument macros

* shear

* revert test change

* clippy, another unused function
2025-01-29 10:50:42 +01:00
Nutomic
f4eb8877a0
Only list local banned users (fixes #2961) (#5364) 2025-01-28 14:10:57 -05:00
Nutomic
8e19d55295
Add some url validation (#5338)
* Add some url validation

* use library fn

* manually follow redirects

* remove log

* avoid infinite redirect/infinite recursion

* fix

* upgrade lib

* check url scheme
2025-01-28 12:37:29 +01:00
Dessalines
52047459bb
Search combined (#5271)
* 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>
2025-01-27 22:58:19 -05:00
Nutomic
aa3f4f07e3
Allow setting multiple values for cors_origin (fixes #5198) (#5353)
* Allow setting multiple values for cors_origin (fixes #5198)

* fmt

* mention env var
2025-01-27 12:54:42 -05:00
Dessalines
012e8c3085
Adding post_id and type_ filters to combined reports. (#5348)
* 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.
2025-01-27 10:13:45 +01:00
Nutomic
8ee81a3967
Change println! to debug! (#5346) 2025-01-23 11:02:02 -05:00
Dessalines
ed55a25e62
Adding a slim comment_view variant, without post or community. (#5335)
* 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.
2025-01-23 10:08:07 -05:00
Nutomic
a531e384b1
Move middleware code into api_routes for faster compilation (#5341)
* Move middleware code into api_routes for faster compilation

* fix wasm

* cleanup
2025-01-23 05:44:05 -05:00
Nutomic
1fdc229338
Send federated reports to all community mods (#5342) 2025-01-22 15:47:07 -05:00
Nutomic
72b74679aa
Change federation community restricted check to apply only locally (#5343)
* Revert "Fetch community mods synchronously (#5169)"

This reverts commit 542e59bcae.

* change restricted check (fixes #5337)
2025-01-22 15:46:07 -05:00
Nutomic
31b8a4bbe0
Implement request idempotency (fixes #4735) (#5329)
* Implement request idempotency (fixes #4735)

* delete old items

* clippy

* remove todo
2025-01-21 11:10:05 -05:00
dullbananas
6f05254aae
Prevent incorrectly using delete instead of uplete (#5331)
* implement check and test it by modifying PostLike::remove

* revert change in PostLike::remove
2025-01-21 09:52:18 -05:00
Dessalines
edb063f288
Upgrading html2text. (#5336) 2025-01-21 10:01:00 +01:00
Nutomic
1d94c26e5a
Return correct status code for rate limit error (ref #5332) (#5333) 2025-01-20 09:54:25 -05:00