Commit graph

4267 commits

Author SHA1 Message Date
Nutomic 6047257bfc
Move admin flag from person to local_user (fixes #3060) (#3403)
* Move admin flag from person to local_user (fixes #3060)

The person table is for federated data, but admin flag can only
apply to local users. Thats why it really belongs in the local_user
table. This will also prevent the federation code from accidentally
overwriting the admin flag

* fmt

* try to fix api tests

* lint

* fix person view

* ci

* ci

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2023-08-24 05:40:08 -04:00
Freakazoid182 51ccf318e8
Lowercase domain on db query filters (#3849) (#3873)
* Lowercase domain on db query filters (#3849)

* Add test to get a community on different cased domain (#3849)

* Lowercase the identity for webfinger (#3849)

* Lowercase both sides of the domain comparison (#3849)

* Format api_tests (#3849)

* Lowercase domain lookup on Instance and Person (#3849)

---------

Co-authored-by: Freek van Zee <freek.van.zee@mediamonks.com>
Co-authored-by: Freakazoid182 <>
2023-08-22 11:10:21 -04:00
Lukas Trombach 28324ad2c8
Sitemap (#3808)
* generate sitemap.xml file

* set up endpoint for sitemap

* Update sitemap generation

- remove sitemap generation from scheduled tasks
- add posts query for sitemap
- create sitemap module in API crate

* remove priority and change freq from sitemap

* add configuration option for number of posts for sitemap

* fix default config

* rate limit sitemap endpoint

* update sitemap query

* update sitemap generation

- remove config value for query limit
- adjust sitemap generation to query changes
- tidy up error handling

* refactor sitemap generation loop

* remove `limit` argument

* refactor `generate_urlset` and add unit test

* change query to only fetch local posts of past 24h

* fix outdated comment and log

* cargo fmt
2023-08-22 10:30:15 -04:00
Alex Roman ab828b81e4
fix: add client connect timeout to scheduled task (#3883) 2023-08-21 10:53:35 +02:00
Freakazoid182 ee7b35a04a
Add person name to PersonIsBannedFromSite error (#3786) (#3855)
* Add person name to PersonIsBannedFromSite error (#3786)

* Log PersonId instead of Person name (#3850)

* Log actor_id for PersonIsBannedFromSite (#3850)

---------

Co-authored-by: Freek van Zee <freek.van.zee@mediamonks.com>
2023-08-16 11:36:58 +02:00
Freakazoid182 c8063f3267
Replace Option<bool> with bool for PostQuery and CommentQuery (#3819) (#3857)
* Replace Option<bool> with bool for PostQuery and CommentQuery (#3819)

* Replace Option<bool> from all list queries (#3819)

---------

Co-authored-by: Freek van Zee <freek.van.zee@mediamonks.com>
2023-08-11 11:13:14 +02:00
Maarten Vercruysse 9b710a2ed3
Update .woodpecker.yml use steps instead (#3858) 2023-08-10 08:15:30 -04:00
Dessalines 654bc513ea
Fixing woodpecker env var. (#3854) 2023-08-09 11:14:09 +02:00
Dessalines 29869b132c
Adding 0.18.4 Release notes. (#3853) 2023-08-09 11:08:32 +02:00
Nutomic f7f6766650
Automatically resolve report when post/comment is removed (#3850)
* Automatically resolve report when post/comment is removed

* also handle apub removes
2023-08-08 11:19:55 -04:00
Nutomic ae438e148e
Speedup CI (#3852)
* Speedup CI

* run tests in parallel

* restore cp

* main push

* no self update

* parallel format
2023-08-08 10:35:03 -04:00
Nutomic 33b2d67be6
Reorder woodpecker config to avoid ci failures (#3851) 2023-08-08 13:09:27 +02:00
dullbananas 969f8b2ce9
Replace TypedBuilder with Default in update forms (#3814)
* Update comment.rs

* Update community.rs

* Update local_site.rs

* Update local_site_rate_limit.rs

* Update local_user.rs

* Update person.rs

* Update comment.rs

* Update community.rs

* Update local_site.rs

* Update local_site_rate_limit.rs

* Update local_user.rs

* Update post.rs

* Update private_message.rs

* Update site.rs

* Update post.rs

* Update person.rs

* Update private_message.rs

* Update comment.rs

* Update create.rs

* Update leave_admin.rs

* Update update.rs

* Update remove.rs

* Update add_admin.rs

* Update verify_email.rs

* Update mod.rs

* Update mod.rs

* Update undo_delete.rs

* Update undo_delete.rs

* Update utils.rs

* Update feature.rs

* Update delete.rs

* Update lock.rs

* Update create.rs

* Update approve.rs

* Update update.rs

* Update lock_page.rs

* Update block_user.rs

* Update delete.rs

* Update undo_block_user.rs

* Update collection_remove.rs

* Update post.rs

* Update hide.rs

* Update person.rs

* Update remove.rs

* Update post_view.rs

* Update create.rs

* Update remove.rs

* Update collection_add.rs

* Update community.rs

* Update update.rs

* Update post_aggregates.rs

* Update update.rs

* Update comment.rs

* Update code_migrations.rs

* Update registration_application_view.rs

* Update update.rs

* Update ban_person.rs

* Update community.rs

* Update delete.rs

* Update delete.rs

* Update delete.rs

* Update person_aggregates.rs

* Update save_settings.rs

* Update distinguish.rs

* Update mark_read.rs

* Update site_aggregates.rs

* Update create.rs

* Fix

* rerun ci

* Update comment.rs

* rerun ci

* Update create.rs

* Update create.rs

* Update post_view.rs

* rerun ci

* Update undo_delete.rs

* rerun ci
2023-08-08 11:41:41 +02:00
dullbananas a47b12bbde
Reduce amount of columns selected (#3755)
* PostAggregatesNotInPost

* CommentAggregatesNotInComment

* CommunityPersonBanAdditionalInfo (partial)

* Revert "CommunityPersonBanAdditionalInfo (partial)"

This reverts commit 158f7f0cd9.

* Replace some nullable parts of selection with id::nullable().is_not_null()

* CommunityFollower::select_subscribed_type

* WithoutId

* Add WithoutId derives

* Update Cargo.toml

* rerun ci

* Fix syntatx errors

* rerun ci

* Add missing "|" in private_message_report_view.rs

* rerun ci

* cargo fmt

* rerun ci

* Only derive WithoutId for Community with "full" feature

* rerun ci

* Fix attribute filtering in WithoutId macro

* rerun ci

* Update without_id.rs

* rerun ci

* Update without_id.rs

* rerun ci

* Fix errors

* rerun ci

* cargo fmt

* Fix errors

* rerun ci

* Move WithoutId to lib.rs

* rerun ci

* Remove macro_use for paste

* rerun ci

* Update comment_reply_view.rs

* rerun ci

* Update registration_application_view.rs

* rerun ci

* Revert "Update registration_application_view.rs"

This reverts commit 2e98e4bb83.

* Revert "Update comment_reply_view.rs"

This reverts commit 857bf9f5a2.

* Revert "Remove macro_use for paste"

This reverts commit 13247279ed.

* Revert "Move WithoutId to lib.rs"

This reverts commit 0c23e5213b.

* Revert "Fix errors"

This reverts commit a283d155e5.

* Revert "cargo fmt"

This reverts commit 36a5210352.

* Revert "Fix errors"

This reverts commit c9102c14f4.

* Revert "Update without_id.rs"

This reverts commit 19adb2fcc8.

* Revert "Update without_id.rs"

This reverts commit e26107a2fe.

* Revert "Fix attribute filtering in WithoutId macro"

This reverts commit acaa4902b0.

* Revert "Only derive WithoutId for Community with "full" feature"

This reverts commit de0e9c6fdc.

* Revert "cargo fmt"

This reverts commit 5e1bd1ce58.

* Revert "Add missing "|" in private_message_report_view.rs"

This reverts commit c7ae9f1cd5.

* Revert "Fix syntatx errors"

This reverts commit d942f099de.

* Revert "Update Cargo.toml"

This reverts commit 23cdb6f6d3.

* Revert "Add WithoutId derives"

This reverts commit 06006d6ad3.

* Revert "WithoutId"

This reverts commit 5e86922b0f.

* Revert "CommentAggregatesNotInComment"

This reverts commit 603aede7ce.

* Revert "PostAggregatesNotInPost"

This reverts commit 1ee3fcaeab.

* Restore original position of options.saved_only filter

* rerun ci

* Update post_view.rs

* rerun ci
2023-08-08 11:41:10 +02:00
Piotr Juszczyk 2ad3450004
Allow filtering posts and comments by whether they were liked/disliked - fixes #3401 (#3523)
* Allow filtering posts and comments by whether they were liked/disliked

* Switch to 2 args - liked_only, disliked_only - taking bools

* Make liked_only and disliked_only Option<bool>

* Fix unrelated is_profile_view compilation error
2023-08-08 11:40:28 +02:00
Alex Lavallee f9c2ba1cfa
Allow filtering PMs by sender (#3770)
* Allow filtering PMs by sender

* Fix retreiving own messages when filtering pm creator id

* Add tests

* Undo rename

* Fix PM tests

* Fix formatting for PMs

* Fix PM test formatting

* Rename PM creator_id field

* Fix PM formatting
2023-08-08 11:07:41 +02:00
Felix Ableitner 91c024fd98 Revert "Version 0.18.4-rc.2"
This reverts commit 48466b6826.
2023-08-07 17:12:09 +02:00
Felix Ableitner 48466b6826 Version 0.18.4-rc.2 2023-08-07 17:09:10 +02:00
maxime.io d81fb987aa
Fix sanitize_html whitespaces (#3829) 2023-08-07 14:22:52 +02:00
Felix Ableitner bed9474cf0 Revert "Attempt to fix CI building wrong commits (#3830)"
This reverts commit 5e9930bdcc.
2023-08-07 13:19:07 +02:00
dullbananas 5e9930bdcc
Attempt to fix CI building wrong commits (#3830)
* Attempt to fix CI building wrong commits

* Update .woodpecker.yml

* Update .woodpecker.yml
2023-08-07 06:40:50 -04:00
Dessalines 57cb5637fc
Fix ordering when doing a comment_parent type list_comments (#3823)
* Fix ordering when doing a comment_parent type GetPost.

* Fix missing options.
2023-08-07 11:11:07 +02:00
Nutomic 66ac8100d9
Remove unused db view options (#3787)
* Remove unused db view options

* fix tests

* ci
2023-08-04 11:36:36 -04:00
Nutomic 2bb24c2859
Remove form_id params (#3812) 2023-08-04 09:22:43 -04:00
Maarten Vercruysse da031a4ce2
Update QUESTION.yml, remove UI (#3807) 2023-08-03 05:12:21 -04:00
Dessalines 70fae9d68d
Fixing broken SQL migration formatting. (#3800)
* Fixing SQL format.

* Fixing clippy lints.

* Fixing clippy lint 2.
2023-08-03 11:07:35 +02:00
Nutomic 2d0f77af59
Dont use sha hash for password reset token (fixes #3491) (#3795) 2023-08-02 13:02:53 -04:00
Nutomic 27be1efb74
Rewrite remaining federation actions, get rid of PerformCrud trait (#3794)
* Rewrite ban actions

* Rewrite delete/remove actions

* Rewrite remove/delete community

* Rewrite report actions

* Rewrite feature/lock post

* Rewrite update community actions

* Rewrite remaining federation actions

* Get rid of PerformCrud trait

* clippy
2023-08-02 12:52:41 -04:00
Dessalines be1389420b
Adding SQL format checking via pg_format / pgFormatter (#3740)
* SQL format checking, 1.

* SQL format checking, 2.

* SQL format checking, 3.

* SQL format checking, 4.

* SQL format checking, 5.

* Running pg_format

* Getting rid of comment.

* Upping pg_format version.

* Using git ls-files for sql format check.

* Fixing sql lints.

* Addressing PR comments.
2023-08-02 12:44:51 -04:00
RocketDerp b4380cb548
Do not hide read posts when it is a user profile view (#3791) 2023-08-02 12:31:28 -04:00
Nutomic 58388f2ce8
Only run slow CI checks for actual code changes (attempt 2) (#3759)
* Only run slow CI checks for actual code changes (attempt 2)

* use when path include

* change rust

* update

* x

* y

* zsad

* remove println

* fmt

* readme

* Revert "readme"

This reverts commit d58b6ad973.

* ci

* gitmodules
2023-08-02 12:29:21 -04:00
Louis GERARD 7bc64ab91a
Remove follow community traits (#3737)
* chore(FollowCommunity): remove Perform and Send Activity traits

* chore(FollowCommunity): avoid fetching community and person from db
2023-08-02 11:32:16 +02:00
dullbananas 91834d0d21
Default imprementations for read and delete in Crud trait (#3707)
* h

* Start doing stuff

* Default impl for Crud::read

* Simplify Crud::read lifetimes

* fmt

* Stuff

* Stuff

* Successfully make default read implementation work

* Restore Person::read

* Clean up default Crud::read and rename 'query2

* Replace filter with find

* Attempt default Crud::create

* Change Crud to Crud<'a> (won't compile)

* Revert "Change Crud to Crud<'a> (won't compile)"

This reverts commit 7ed20f5f71.

* Default Crud::delete

* Remove Crud::delete definitions that match default

* Remove commented Site::read

* Insert trait

* Revert "Insert trait"

This reverts commit 9d780c2403.

* Use non-borrowed forms

* Revert "Use non-borrowed forms"

This reverts commit d2dd442563.

* Revert "Revert "Change Crud to Crud<'a> (won't compile)""

This reverts commit 25a27165a8.

* Fix lifetime for everything except Crud::delete

* Fix Crud::delete

* Add comment about futures

* Attempt Crud::create

* Attempt separate CrudBounds

* Revert "Attempt separate CrudBounds"

This reverts commit 1b4ca321c3.

* Try to fix Crud::create

* Move lifetime parameters to associated types

* Revert "Move lifetime parameters to associated types"

This reverts commit af1bc858ce.

* Revert "Try to fix Crud::create"

This reverts commit eec238496c.

* Revert "Revert "Attempt separate CrudBounds""

This reverts commit 1ec33ce502.

* Revert "Attempt separate CrudBounds"

This reverts commit 1b4ca321c3.

* Revert "Attempt Crud::create"

This reverts commit 47e8071b68.

* Revert "Add comment about futures"

This reverts commit b266b14653.

* Revert "Fix Crud::delete"

This reverts commit 3abcce2eec.

* Revert "Fix lifetime for everything except Crud::delete"

This reverts commit c1ad7a161b.

* Revert "Revert "Revert "Change Crud to Crud<'a> (won't compile)"""

This reverts commit 3129cd0fc3.

* Clean up

* Update site.rs
2023-08-01 10:34:10 -04:00
Nutomic d82194cfe9
Rewrite some federation actions to remove Perform/SendActivity (ref #3670) (#3758) 2023-08-01 15:53:36 +02:00
RocketDerp 05a7fced65
Enhanced testing of comments. Validate reply notifications, mentions (#3686)
* shared.ts first test of getReplies

* comment testing now validates reply notifications and mentions, some code comment cleanup in other functions

* comments revised

* first use of getUnreadCount in testing

* test notification of new comment replies, clarify usage of getReplies

* killall moved earlier in bash script

* api-test jest run does not need directory prefix, make consistent with other jest runs

* do not put my testing system password into script

* fix, killall exits script when no process found

* killall now moved to parent script to release locks before database create

* need to run killall a second time, before database drop

* first use of getReplies getPosts saveUserSettings

* accidental duplication of functions, removed

* try to sync shared library with main

* Nutomic feedback: Better to rename the var instead of putting a comment which can easily get outdated.

* Correct logic to meet join-lemmy requirement, don't have closed signups. Allows Open and Applications. (#3761)

Co-authored-by: Josh Bernardini <josh.bernardini@cologix.com>

* Fix fetch instance software version from nodeinfo (#3772)

Fixes #3771

* remove unused code, revert killall change

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: figure-0e <133478007+figure-0e@users.noreply.github.com>
Co-authored-by: Josh Bernardini <josh.bernardini@cologix.com>
Co-authored-by: Denis Dzyubenko <denis@ddenis.info>
Co-authored-by: Felix Ableitner <me@nutomic.com>
2023-08-01 09:14:40 -04:00
Denis Dzyubenko 55e383ae38
Fix fetch instance software version from nodeinfo (#3772)
Fixes #3771
2023-08-01 10:55:28 +02:00
figure-0e 6ed2ddf76d
Correct logic to meet join-lemmy requirement, don't have closed signups. Allows Open and Applications. (#3761)
Co-authored-by: Josh Bernardini <josh.bernardini@cologix.com>
2023-08-01 10:40:42 +02:00
Felix Ableitner 963d04b352 Revert "Only run slow CI checks for actual code changes (#3750)"
This reverts commit a34e0d477e.
2023-07-28 22:44:45 +02:00
Nutomic 543bd99900
Update CODEOWNERS (#3748) 2023-07-28 11:16:18 -04:00
Nutomic 39752fa096
Delete migrations_testing folder (#3751)
Its completely unused as far as I can see
2023-07-28 11:14:26 -04:00
Nutomic e365d48769
Move entry from .rgignore to .gitignore (#3752)
rg command respects gitignore, and sql dumps should be ignored by
git as well. So theres no reason to have a separate file.
2023-07-28 11:11:18 -04:00
Nutomic 37998b3398
Rewrite some API handlers to remove Perform trait (#3735)
* Rewrite some API handlers to remove Perform trait

* Convert CreateComment

* ci
2023-07-28 10:39:38 -04:00
Dessalines db76c5b7ff
Adding 0.18.3 Release notes. (#3753) 2023-07-28 16:33:45 +02:00
Nutomic a34e0d477e
Only run slow CI checks for actual code changes (#3750)
* Only run slow CI checks for actual code changes

Its a waste of time to compile Rust and run tests when only
something like the readme was changed.

* also make cache restore/rebuild conditional

* remove unused condition
2023-07-28 09:33:23 -04:00
Nutomic 0e6fb08284
Restore markdown quotes after sanitize (#3708) (#3749) 2023-07-28 08:23:46 -04:00
dullbananas 9a5a13c734
Use same table join code for both read and list functions (#3663)
* Try stuff

* Revert "Try stuff"

This reverts commit 3da5f83a8b.

* Revert "Revert "Try stuff""

This reverts commit 178bd43cac.

* Revert "Revert "Revert "Try stuff"""

This reverts commit b9f9a2316e.

* Revert "Revert "Revert "Revert "Try stuff""""

This reverts commit ccd498dd72.

* Try more stuff

* Add queries function

* Simplify queries function

* Move aliases to db_schema

* Revert "Move aliases to db_schema"

This reverts commit 69afed05c1.

* Add ReadFuture and ListFuture

* Refactor queries function and add Queries struct

* Box futures in Queries::new

* Use from_tuple

* Add comment_view::queries and improve comment_report_view::queries

* Add local_user_view::queries

* Add post_report_view::queries

* Ad post_view::queries

* Add private_message_report_view::queries

* private_message_view, registration_application_view

* Use 'a in BoxedQuery

* comment_reply_view, community_view

* Change aliases to inline module

* person_mention_view

* person_view

* Use separate community_person_ban joins instead of including boolean literal in join-on clause

* Fix comment_view

* rerun ci
2023-07-28 10:36:50 +02:00
phiresky e315092ee3
remove n^2 part of person triggers, improve community aggregate trigger (#3739)
* remove n^2 part of person triggers, improve community aggregate trigger

* comment out comment_score tests since previously they only accidentally succeeded

* empty
2023-07-27 23:36:51 +02:00
phiresky 1253a2a0d5
remove performance-problematic and buggy duplicate site aggregates (#3732) 2023-07-27 23:35:53 +02:00
Nutomic d909f3455d
Change readme installation link (#3736)
Replaces https://github.com/LemmyNet/lemmy/pull/3551
2023-07-27 09:42:52 -04:00
RocketDerp 21a87ebaf2
Federation tests replication round1 - demonstrate absent replication of comment deletes (#3657)
* more robust test of unlike a comment, confirm replication to instance downstream from community home

* more robust 'delete a comment' test, confirm replication

* Far more robust "Report a comment" test. Many comments about situation, this is currently failing because gamma does not get the report

* typo and actually have Gamma comment check use gamma, not alpha

* prepare-drone-federation-test.sh has some more echo output and note about the LEMMY_DATABASE_URL format (#3651)

* Add http cache for webfingers (#3317)

* Add http cache for webfingers

* Remove the outgoing cache middleware & adjust the cache headers directive

* Use 1h & 3day cache header

* Update routes and adjust the cache headers location

* revert apub caching

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Felix Ableitner <me@nutomic.com>

* Rewrite activity lists to fix delete federation (fixes #3625)

* Revert "typo and actually have Gamma comment check use gamma, not alpha"

This reverts commit 7dfb6ee0f4.

* Revert "Far more robust "Report a comment" test. Many comments about situation, this is currently failing because gamma does not get the report"

This reverts commit 7bd3b20ae0.

* prettier TypeScript

* revised comments, as ResolveObject isn't using routine replication

* fmt

* fix api tests

* remove comment

---------

Co-authored-by: cetra3 <cetra3@hotmail.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Felix Ableitner <me@nutomic.com>
2023-07-27 06:17:40 -04:00