Commit graph

5400 commits

Author SHA1 Message Date
Nutomic
d77c9a0544
Drop table person_ban (fixes #5828) (#5831) 2025-06-26 13:13:39 -04:00
Nutomic
35f48c5a95
Better way to check if we should accept activity in remote community (#5823)
* Better way to check if we should accept activity in remote community (fixes #5596)

* fix test
2025-06-26 12:52:17 -04:00
Dessalines
a6b03fabdb
Keep totals of upvotes and downvotes given to each user. (#5786)
* Keep totals of upvotes and downvotes given to each user.

- Adds a `voted_at`, `upvotes` and `downvotes` to person_actions.
- Didn't use triggers, because I couldn't figure out how to get the
  voter, and also because it should only be for local users anyway.
- Fixes #2370

* Clippy

* Adding history filling.

* Try to fix postgres alias error 1

* Update crates/db_schema/src/impls/person.rs

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>

* Addressing PR comments

* Removing commented line.

* Fixing type errors.

* Fixing test

* Fixing like score 0 and api test errors.

* Some clippy fixes

* Update migrations/2025-06-14-141408_person_votes/up.sql

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

* Update migrations/2025-06-14-141408_person_votes/up.sql

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

* Update migrations/2025-06-14-141408_person_votes/up.sql

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

* Formatting sql

* Fixing migration.

* Cleaning up merge

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
2025-06-26 09:58:10 +02:00
Dessalines
d274d2bb1d
Remove votes when ban + remove data for a site or community. (#5810)
* Remove votes when ban + remove data for a site or community.

- Fixes #5569

* Starting to revert cleanup.

* Finishing up.
2025-06-26 09:52:13 +02:00
Dessalines
9ccd647e02
Fixing docker_update.sh script to not add context. (#5820)
* Fixing docker_update.sh script to not add context.

Use docker build from a higher level to not load massive context.

* Adding a custom postgresql for testing.

* Fixing docker update

* Fixing dir.

* Fix rust log

* Add bash / shell file format checking.

* Adding shfmt package.

* Running bash format.

* Fixing bash fmt.

* Fixing bash fmt 2.

* Adding pgtune note.
2025-06-26 09:48:39 +02:00
Dessalines
78fc703ebd
Optimizing person_content_combined migration. (#5819) 2025-06-26 09:40:21 +02:00
Nutomic
cc61b70b29
Send Undo/Dislike activity (fixes #4465) (#5825) 2025-06-24 10:29:01 -04:00
Dessalines
7e55a39677
Optimizing a few more combined migrations (#5821)
* Add indexes after insert to search_combined.

* Add indexes after for inbox_combined.

* Move index after for modlog combined.

* Fixing unique.
2025-06-24 10:22:17 -04:00
Nutomic
99ec0b7116
Rename rate limit columns (fixes #5805) (#5824)
* Rename rate limit columns (fixes #5805)

* update js client
2025-06-24 10:21:50 -04:00
Nutomic
497ec72f26
Optimize migrations (#5800)
* Fix migration local_image_person

* Make constraints deferrable (ref #5798)

* Some more adjustments

* fix down migrations

* set not deferrable once done

* fix

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-06-23 08:05:21 -04:00
dullbananas
6accb4110d
Fix db_perf.sh (#5815)
* db_perf.sh

* get_option function
2025-06-22 11:56:10 -04:00
Nutomic
0a22fac562
Remove creator_*_actions fields from api (ref #5532) (#5808)
* Dont return action structs in api (ref #5532)

* rename methods

* Remove creator instance fields, add missing check

* update js client

* Remove remaining creator actions

* update api tests
2025-06-20 11:58:41 -04:00
Nutomic
06e7ea00b8
Move config updated check to unit test, use diffy (#5803)
* Move config updated check to test

* use diffy

* clippy

* Fixes for "Move config updated check to unit test, use diffy" PR (#5812)

* replace diffy with unified_diff in test_config_defaults_updated

* revert changes to lemmy_db_schema_file

* use unified_diff in diff_check

* simplify

---------

Co-authored-by: dullbananas <dull.bananas0@gmail.com>
2025-06-20 08:42:37 -04:00
Dessalines
e07e251ada
Removing an existing deferrable constraint, and fail test if any constraint is deferrable. (#5806)
* Removing an existing deferrable constraint.

- Also adding a check to make sure the final dump contains no DEFERs.

* Spelling error
2025-06-20 09:49:44 +02:00
dullbananas
fb762a3f9b
Remove outdated comment about deferrable constraints in triggers.sql (#5813) 2025-06-20 09:49:07 +02:00
Nutomic
9e3395dc22
Switch to library for rate limit (fixes #5550, fixes #5548) (#5731)
* Switch to library for rate limit (fixes #5550, fixes #5548)

* move debug rate limit logic

* move to file

* various rate limit methods

* move to utils crate

* use new code

* delete old rate limit code

* live updates

* live updates working

* clippy

* use binary keys

* clippy

* remove error

* cleanup
2025-06-19 18:52:56 -04:00
Nutomic
7cda94ca97
Set Accept: Vary header (fixes #5632) (#5809) 2025-06-19 18:44:48 -04:00
Nutomic
1f190e015e
Add incoming activity hook for plugins (#5792)
* Add incoming activity hook

* async working

* remove generic

* update with references

* remove insert_received_activity

* remove todo

* use crates.io dep
2025-06-18 16:28:25 +02:00
Nutomic
9a84180b5a
Fix migration local_image_person (#5799) 2025-06-18 08:56:01 -04:00
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