Commit graph

5381 commits

Author SHA1 Message Date
Anton Boitsov
070d049c49
Test migrations improvement (#5788)
* some test data in migration tests after initial setup (40 migrations)

* - fixed migration rollbacks creating NOT NULL fields without DEFAULT value
- added couple of checks

* fix sql fmt

* fix sql fmt

* allow indexing and unwrapping in tests
2025-06-18 09:39:08 +02:00
Nutomic
66540f1fe7
Delete scripts/ts_bindings_check.sh (#5797) 2025-06-17 11:20:58 -04:00
Dessalines
aef564f098
Better ntfy notifs. (#5793) 2025-06-17 11:37:18 +02:00
Nutomic
bc23e95f50
Implement multi-community (fixes #818, fixes #5340) (#5601)
* Implement multi-community (fixes #818, fixes #5340)

* db methods

* add api methods

* ts opt

* wip

* sql queries

* cleanup

* wip: federation

* query by name

* add ap_id column

* add read_apub, compiles now

* validate multi-comm name

* disallow removed, deleted, private

* scheduled task

* remove piefed test

* resolve_object with workaround

* review

* avoid db read

* api client

* fix api test fetch

* wip: test cases

* wip

* add max elements, array_remove comments

* simplify post view query

* mvoe structs

* fix api test

* fix api test

* rename to suggested_communities, add api param

* filter removed/deleted

* check_api_elements_count

* filter out removed/deleted during update

* inner join

* add listing type suggested

* db schema changes

* transaction

* address some review comments

* separate methods for create, delete entry

* update js client

* get multi

* remove CommunityOrMulti

* check helper, other stuff

* fix api test

* change get multi comm return type

* Replace MultiCommunityView with GetMultiCommunityResponse

* get rid of todo

* add local column, admins can edit local multi-comm

* implement multi-comm follow (db and api)

* api for multi-comm follow

* move and rename MultiCommunityApub

* move multi-comm to apub-objects

* move multi-comm url to top-level

* list multi-comms followed by user

* add todo

* remove param

* update local follows

* update query

* db functions and tests

* cleanup

* fix api test

* add entry limit

* rewrite links

* federation changes

* wip federation

* simplify generate_activity_id

* more wip

* more wip

* multi-comm follow

* federate changes

* cleanup

* clippy

* test fixes

* fmt

* fix

* wip: update follows after federated multi-comm change

* remove scheduled task

* update follows after multi update

* fmt

* fixes

* review comments

* indexes

* remove MultiCommunityApub

* fix test

* ts fix

* review

* db schema for local_site.multi_comm_follower

* adjust code and tests

* fixes

* cleanup, comment

* fix tests

* fix

* remove more test code

* fix new install

* add index

* fix api tests

* fix

* remove index

* more fix

* Implement multi-community search (fixes #5778) (#5779)

* Implement multi-community search (fixes #5778)

* fixes

* search title and description

* MultiCommunityView

* rename fields

* revert test change
2025-06-17 11:04:47 +02:00
Dessalines
c198c98bed
Remove ts-bindings null check from CI. (#5795)
- This takes 12 minutes, and its a waste of time.
- I'm adding it to the lemmy-js-client copy script which needs to
  do this build there anyway, so errors will be found while devving.
2025-06-17 09:39:51 +02:00
SleeplessOne1917
8024e46d89
More reexports (#5796) 2025-06-17 00:47:00 +00:00
Integral
313e2ff061
chore: replace nightly API Duration::from_days with Duration::from_secs (#5791) 2025-06-16 11:56:03 -04:00
Nutomic
5c6e7c32b0
Replace most uses of context.reset_request_count() with clone() (#5790)
* Replace most uses of context.reset_request_count() with clone()

* fix features

* replace more

* reset count for community collection fetch
2025-06-16 11:54:54 -04:00
dullbananas
bb63eaa794
Improve migration diff check and fix old migrations (#5204)
* 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 migration duplication caused by merge

* optimize

* Merge remote-tracking branch 'upstream/main' into new-migration-diff-check

* fmt

* Revert "fmt"

This reverts commit 7d5652945f.

* Revert "Merge remote-tracking branch 'upstream/main' into new-migration-diff-check"

This reverts commit 28bb1c7497.

* fmt

* move diff dependency to db_schema_file

* stuff

* revert some migration changes

* stuff

* refactor pair selection

* fix all migrations

* clippy

* stuff

* remove thing from removed dbg

* remove use of BTreeSet::difference

* trim_matching_chunks_at_beginning_and_end

* use sorted_unstable itertools method

* display_diffs

* use aho-corasick for chunk filtering

* fsync=off

* remove some unimportant optimizations

* Revert "remove some unimportant optimizations"

This reverts commit f8d88ddcce.

* Revert "use aho-corasick for chunk filtering"

This reverts commit 6b1f3e4416.

* remove some unimportant optimizations

* refactor diff_check.rs

* clippers
2025-06-16 11:35:41 -04:00
SleeplessOne1917
d1aed75956
Small lemmy_api_common/db_views fixes/tweaks (#5783)
* Refactor Taglines

* Include crate ts-rs dependencies when needed, move some views to account_management views

* Re export NotePerson from lemmy_api_common

* Remove unused "full" feature from lemmy_db_views_tagline

* Replace "full" feature in lemmy_api_common with "ts-rs"

* Remove newly added db_views crates and put structs in existing db_views crates
2025-06-16 10:34:05 +02:00
dullbananas
38e87f6dc4
Fix assumption that is_err always means the local site doesn't exist, which may cause the local site's keypair to be regenerated (#5724)
* Fix assumption that is_err always means the local site doesn't exst, which may cause things like keypairs to be overwritten

* remove use of unstable feature

* fix map_err

* exists query and transaction
2025-06-13 19:12:12 -04:00
Dessalines
ba0099e7a2
Fixing a few optionals. (#5782)
* Fixing a few optionals.

* Fixing note.
2025-06-12 13:19:06 -04:00
Nutomic
a2ef488528
Move db_perf check to unit test (#5781)
* Move db_perf check to unit test

* remove ci step
2025-06-12 11:14:26 -04:00
Dessalines
42bd941f35
Upgrading ts-rs, and adding feature flag (#5777)
* Upgrading ts-rs, and adding feature flag.

- Lets us remove all the ts-optionals on every field.
- Should speed up compilation, and this feature is only needed for
  lemmy-js-client.
- Fixes #5741

* Removing ts_optional_fields from enums

* Updating translations.

* Fix tests

* Fixing translations

* Adding ts-rs feature to ts_bindings script

* Consolidating optional fields and export to one line.

* Dont export federation_queue_state
2025-06-12 16:30:48 +02:00
Dessalines
d9df8335ea
Adding ability to make a note for a given person. (#5765)
* Adding ability to make a note for a given person.

- This comes back with PersonActions.note, already on post and comment
  views.
- Also adds person_actions to PersonView, so that the read person API
  action can return the note.
- Fixes #2353

* Adding unit test for person_view read.

* Fixing bindings check

* Addressing PR comments

* Moving API action to person/note
2025-06-12 16:29:03 +02:00
Nutomic
ea9b19bea8
Make search query mandatory (#5772)
* Make search query mandatory

* update js client
2025-06-12 08:16:11 -04:00
Nutomic
b4c3cda061
Use binstall for diesel-cli (#5780)
* Use binstall for diesel-cli

* features
2025-06-12 08:14:45 -04:00
Nutomic
7675524e46
Keep rustup home dir between ci steps (#5775) 2025-06-11 16:54:42 -04:00
Nutomic
15cfb90b7b
Enable urlencoding for pictrs proxy parameter (fixes #5749) (#5776) 2025-06-11 16:54:21 -04:00
Nutomic
896e8f1896
Parallel sql format (#5773)
* Parallel sql format

* change image

* -q

* unformatted

* Revert "unformatted"

This reverts commit 22e79fe4c5.

* -q
2025-06-11 16:35:41 -04:00
Dessalines
398c9ec967
Rename timestamp fields to _at (#5761)
* Adding migration for renaming timestamps to at

* Running format.

* Updating code to _at

* Fix replaceable schema

* Fixing scheduled tasks.

* Fixing and cleaning up api tests.

* Fixing cargo shear.
2025-06-11 09:38:24 +02:00
Dessalines
0ba6b01195
Upgrading deps. (#5764)
- Waiting on ts-rs:  see #5448
- sitemap-rs requires the rust 2024 edition, which is blocked by our
  dependence on rust 1.81
2025-06-10 16:41:42 -04:00
Nutomic
0e875a3503
Resolve objects as part of search api call (fixes #5740) (#5752)
* Resolve objects as part of search api call (fixes #5740)

* clippy

* use search response, cleanup test

* update api tests

* fix error handling

* another fix
2025-06-10 11:09:56 -04:00
Nutomic
cbb780f79a
Rename upgrade check migration to run first (#5768)
* Rename upgrade check migration to run first

* fix column name
2025-06-10 10:28:51 -04:00
Nutomic
fea383dda3
Update extism (#5755)
* Specify Rust version 1.81

* fix ci

* Update extism and other deps

* Extism code changes

* main branch

* fix compile, no default features

* enable default
2025-06-10 10:09:04 -04:00
SleeplessOne1917
b77ab870d4
Add permitted display characters check for post titles (#5692)
* Add permitted display characters check for post titles

* Remove accidental formatting change

* Use invisible-chars crate for validation

* Adding invisible chars library (#5759)

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
2025-06-10 09:42:37 -04:00
Nutomic
30cbd713ef
Remove private instance check for get image (fixes #5763) (#5769) 2025-06-10 09:32:02 -04:00
Nutomic
0668a38a2a
Remove feature full for api_utils (#5767)
* Remove feature `full` for api_utils

* move api crates to subfolder
2025-06-10 09:26:36 -04:00
SleeplessOne1917
db44742bbb
Move lemmy_api_common structs to view crates, make a lemmy_api_utils crate (#5735)
* Move EditCommunity

* Move more community stuff

* Finish moving community related structs to db views

* Move comment structs to db views

* Move person structs to db views

* Forgot to add file to staged changes

* Move custom emoji structs to db views

* Move post structs to db views

* Move private message structs to db views

* Finish moving structs out of lemmy_api_common

* Re-export post, comment, and community structs from lemmy_api_common

* Export person structs from lemmy_api_common

* Re-export custom emoji structs

* Re-export private message structs

* Re-export federation, media, moderation, search, and site structs

* Re-export most of everything

* Handle re-exports that weren't already covered (except errors)

* Add error types, reorganize some more

* Another once over to make sure I missed nothing

* Finish re-arranging re-exports for draft PR

* Update email translations submodule

* Ensure that exporting typescript bindings works

* Run taplo fmt and cargo fmt

* Move API structs into relevantly grouped crates instead of having 1 crate per struct

* Fix compilation error

* Fix broken cargo shear CI step

* fix SuccessResponse::default

* set publish false

---------

Co-authored-by: Felix Ableitner <me@nutomic.com>
2025-06-10 06:58:28 -04:00
Nutomic
eef8821b42
Specify rust 1.81 (#5754)
* Specify Rust version 1.81

* fix ci
2025-06-06 19:04:30 -04:00
Nutomic
7458a9728d
Fix lemmy_federate test (again) (#5757) 2025-06-06 15:56:36 +02:00
Nutomic
3aaa52820c
fix send test (#5756) 2025-06-06 13:09:32 +02:00
Dessalines
079ca69312
Adding Modlog RSS feed. (#5708)
* Adding Modlog RSS feed.

- Fixes #3179

* Addressing PR comments

* Fixing clippy.

* Fixing markdown test.

* Creating common format_actor_url function.

* Clippy

* Adding boolean strings for remove/restore

* Addressing PR comments
2025-06-04 10:18:53 -04:00
Nutomic
ced74b40cc
Test case for activity send errors (#5747) 2025-06-04 15:59:45 +02:00
Dessalines
fa9be76148
Adding proper NSFW filtering to search, based on user settings. (#5733)
* Adding proper NSFW filtering to search, based on user settings.

- This works just like `list_posts`, and can be overridden via the API
  call.
- Fixes #3014
- Fixes #5528

* Filter out comments and posts in NSFW communities.
2025-06-04 08:51:25 -04:00
Nutomic
fa6d375fbf
Pin cargo-workspaces version (#5746) 2025-06-04 08:51:04 -04:00
Nutomic
64ed2a3cd2
Mark some *Action struct fields as serde(skip) (ref #5532) (#5739) 2025-06-04 09:58:24 +02:00
dullbananas
9f425b8f42
Throw error if the removed code_migrations.rs needed to run but didn't (#5723)
* Throw error if the removed code_migrations.rs needed to run but didn't

* support postgresql 15

* improve error message

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-06-03 11:38:50 -04:00
Nutomic
47111a8c6c
Dont run scheduled tasks at startup (ref #5716) (#5732)
* Dont run scheduled tasks at startup (ref #5716)

* fix test

* move to daily

* reorder

* utc
2025-06-03 10:47:57 -04:00
Nutomic
8bab413d83
Decrement fail_count instead of reset to 0 (ref #5716) (#5717) 2025-06-03 10:33:09 +02:00
Anton Boitsov
f323da00f8
Simplifying transaction call (#5703) (#5726)
* Simplifying transaction call (#5703)

* fmt fix

* changing other transaction calls

* fmt fix
2025-06-03 09:43:02 +02:00
Dessalines
0ee3262c58
Leave mod teams on account deletion. (#5721)
* Leave mod teams on account deletion.

- Fixes #5713

* Add comment.
2025-06-02 10:22:41 -04:00
Nutomic
71159805cf
Upgrade apub lib to 0.7.0-beta.1 (#5730) 2025-06-02 09:23:35 -04:00
Dessalines
9250460b11
Add endpoint to get Liked / Disliked comments and posts. (#5616)
* 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

* 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

* Starting to work on removing rest of page / limit.

* Issues with community pagination.

* Rename the traits and paginationcursor::new

* remove duplicate fields

* remove "aggregates" from index names

* uncomment indices

* if count = 0

* Using combined trait.

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

* Removing empty files.

* 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

* Updating lemmy-js-client.

* Fixing a few cases.

* Fixing list_banned.

* Starting to convert to lemmy results.

* Fixing vote_view.

* Close to finishing up errors.

* Got compiling.

* Remove tracing for CI.

* Removing unused errors.

* Fixing merge from main.

* lower_name community_view sort.

* Syntax errors.

* Removing rest of Result from db_schema, db_views.

* Finally compiling again.

* fmt.

* Subpath tries again.

* Adding some more indexes./

* Fixing shear.

* Fix keyword_blocks test.

* @dullbananas fixes to Subpath, fixing comment tests.

* sql fmt

* Fixing unused error.

* API test fixing

* Moving read_only_posts to its own endpoint, sorted by read date.

- Fixes #5505

* Adding endpoint to list hidden posts.

- Fixes #5607

* Adding a first_id helper function.

* Fixing api_common

* Adding a person/liked endpoint for posts and comments.

- Fixes #4499

* Get rid of old liked_only filters.

* Formatting sql.

* Clippy

* Fixing view tests.

* SQL fmt

* Addressing PR comments

* Addressing PR comments 1.

* Using id desc.

* Addressing PR comments 2.

* Removing the reverse_timestamp keys for the post table.

* Make community_title and community_lower_name indexes desc

* Remove featured_community from post sort

* Forgot to drop index.

* Addressing PR comments

* Fixing clippy.

* Adding person_local column to post_actions and comment_actions

* Fixing pg_format

* Fixing pg_format 2

* Revert "Adding person_local column to post_actions and comment_actions"

This reverts commit e5145d8b07.

* Adding local person check to liked and saved combined.

* Formatting sql.

* Adding local check to migration.

* Addressing PR comments

* Try to add versioned pg_formatter 1

* Try to add versioned pg_formatter 2

* Try to add versioned pg_formatter 3

* Try to add versioned pg_formatter 4

* Moving back to correct location.

---------

Co-authored-by: Felix Ableitner <me@nutomic.com>
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
2025-06-02 11:15:27 +02:00
renovate[bot]
7504738de0
Update Rust crate clap to v4.5.39 (#5728)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-31 23:11:57 -04:00
renovate[bot]
caffab4e58
Update Rust crate chrono to v0.4.41 (#5727)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-31 23:11:25 -04:00
Nutomic
545c6de2cd
Ci remove nightly build (#5720)
* Fix build_args for release builds (fixes #5718)

* fix syntax

* Remove nightly build from ci

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-05-30 10:39:01 -04:00
Nutomic
34c5e1e897
Get rid of code_migrations.rs (#5710)
* Get rid of code_migrations.rs

* add back local site setup
2025-05-30 10:37:13 -04:00
Nutomic
df94566f3c
Remove unnecessary InCommunity impls (fixes #5700) (#5715) 2025-05-30 10:33:53 -04:00
Nutomic
0de0ca2f07
Fix build_args for release builds (fixes #5718) (#5719)
* Fix build_args for release builds (fixes #5718)

* fix syntax
2025-05-30 10:11:35 -04:00