dullbananas
6497ec519e
Refactor LocalUser settings conditions in database views ( #4746 )
...
* Create viewer.rs
* Rename viewer.rs to viewer.rs
* Update viewer.rs
* Update post_view.rs
* Update distinguish.rs
* Update like.rs
* Update viewer.rs
* Update list_comment_likes.rs
* Update like.rs
* Update save.rs
* Update like.rs
* revert changes in api crate
* Update post_view.rs
* Update post_view.rs
* Update comment_view.rs
* Update post_view.rs
* Update community_view.rs
* Update comment_view.rs
* Update post_view.rs
* Update viewer.rs
* Update post_view.rs
* Update community_view.rs
* Update local_user_view.rs
* Update viewer.rs
* Update community_view.rs
* Update viewer.rs
* Update lib.rs
* Update comment_view.rs
* Update post_view.rs
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Update local_user_view.rs
* Update viewer.rs
* Update viewer.rs
* Update local_user_view.rs
* Update community_view.rs
* Update viewer.rs
* Update crates/db_schema/src/viewer.rs
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Update post_view.rs
* Update community_view.rs
* Update comment_view.rs
* Update viewer.rs
* Update post_view.rs
* Update save.rs
* Update resolve_object.rs
* Update viewer.rs
* Update save.rs
* Update resolve_object.rs
* Update comment_view.rs
* Update post_view.rs
* Update community_view.rs
* Update local_user_view.rs
* Update post_view.rs
* Update viewer.rs
* Update comment_view.rs
* Update post_view.rs
* Update community_view.rs
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Update viewer.rs
* Some additions to localuser DB view helpers. (#39 )
* Some additions to localuser DB view helpers.
- Getting rid of generics.
- Passing in only LocalUser to views.
* Formatting fixes.
* Getting rid of unecessary as_refs
* Fixing clippy.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
2024-06-14 21:51:24 -04:00
Dessalines
abcfa266af
Fixing slowness in saved post fetching. #4756 ( #4758 )
...
* Fixing slowness in saved post fetching. #4756
* Also fix comment_view.rs
2024-05-29 17:03:42 -04:00
dullbananas
ec77c00ef8
Fix lost separation caused by comment width change ( #4739 )
...
* Update post_view.rs
* Update structs.rs
* Update worker.rs
* Update worker.rs
2024-05-23 14:05:35 -04:00
c96017c009
Configure max comment width in clippy ( #4738 )
...
* Configure max comment width in clippy
* update default config
2024-05-23 08:46:26 -04:00
723cb549d4
Allow importing partial backup ( fixes #4672 ) ( #4705 )
...
* Allow importing partial backup (fixes #4672 )
* Dont throw error on empty LocalUser::update
* fix tests
2024-05-14 22:37:30 -04:00
Dessalines
2fecb7ecdf
Dont show own comments for liked and disliked_only. Fixes #4675 ( #4679 )
...
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
2024-04-30 23:26:55 -04:00
Dessalines
5c35e97a75
Dont show deleted / removed posts when searching. Fixes #4576 ( #4671 )
...
* Dont show deleted / removed posts when searching. Fixes #4576
* Address PR comments.
* Clean up comment removed also.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
2024-04-30 12:24:18 +02:00
TechVest
b0370ae2fd
chore: fix some comments ( #4637 )
...
Signed-off-by: TechVest <techdashen@qq.com>
2024-04-17 14:35:54 +02:00
Dessalines
d075acce43
Make all single-fetch database calls return an Option. ( #4617 )
...
- Diesel ordinarily throws an error when no results are returned for a
single fetch, which is a bit confusing. This PR ensures that the
missing value cases are all caught, and wrapped with new LemmyErrors,
rather than diesel errors.
- Fixes #4601
2024-04-16 14:48:15 +02:00
Dessalines
e4356a7701
Fixing a few broken tests from the change in LocalUser::create ( #4569 )
2024-03-25 19:14:35 -04:00
846848c4f6
On registration, automatically set content languages from accept-language
header ( #4550 )
...
* On registration, automatically set content languages from accept header
* no need to set site language or default language for new user anymore
* fix test
* fix langs
* avoid duplicate writing of new user languages
2024-03-25 16:02:12 -04:00
SleeplessOne1917
38c22d9453
Add banned_from_community to PostView and CommentView ( #4552 )
...
* Add banned_from_community to PostView and CommentView
* Add post view test
* Add tests for CommentView
* Add tests for case where local user is not banned from community
---------
Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
2024-03-22 18:31:08 -04:00
Dessalines
15f02f00a9
Add a vote_display_mode local_user setting. ( #4450 )
...
* Add a vote_display_mode local_user setting.
- Fixes #4449
* Changing HideDownvotes to Score.
* Adding ScoreAndDownvote display mode.
* Adding upvote and downvote mode.
* Extracting vote_display_mode to another table.
* Fixing fmt.
* Remove published and updated columns.
---------
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
2024-03-13 12:10:58 -04:00
Dessalines
7f9950fe85
Add alt_text for posts. Fixes #1086 ( #4477 )
...
* Add alt_text for posts. Fixes #1086
* Moving alt_text to attachment name.
* Cleaning up mod action line.
* Addressing PR comments
* Addressing PR comments.
* Fixing clones.
2024-03-05 11:34:57 +01:00
Dessalines
eb1245bceb
When using saved_only
, sort posts / comments by the saved publish time, not the item creation time ( #4479 )
...
* Work on saved selection.
* Using single value for join.
* Removing unecessary check.
* Remove saved_only pointless block.
2024-03-04 14:19:51 +01:00
Dessalines
87b577467b
Adding ability to hide posts. ( #4480 )
...
* Adding ability to hide posts.
- Adds an post/hide API route.
- Adds a `show_hidden` (default false) to `GetPosts`.
- Adds a `hidden` field to `PostView`.
- Removes the single `post_id` from MarkPostAsRead.
- Fixes #1403
* Add a check to make sure hidden field is true.
* Fixing test.
* Add back semicolon
2024-02-29 10:42:34 -05:00
86b44c2a4d
Add site.content_warning, local_site.default_post_listing_mode ( #4393 )
...
* Include local_site.content_warning setting for showing nsfw by default
* Add community setting `only_followers_can_vote`
* clippy
* add auto_expand_images site setting
* cleanup
* add missing api params
* postquery/communityquery changes
* clippy
* change error
* replace auto_expand_images with default_site_post_listing_mode
* change post/community query params
* get rid of only_followers_can_vote
* machete
* fix
* clippy
* revert remaining vote changes
* remove dead code
* remove unused var
* fmt
2024-02-16 07:24:35 -05:00
Dessalines
33989f5518
Blocking an instance also hides private messages from their users. ( #4447 )
...
* Blocking an instance also hides private messages from their users.
- Fixes #4444
* Separating private message tests.
2024-02-14 10:49:55 +01:00
0f414a95d5
Local only community ( #4350 )
...
* Add support for local only community (fixes #1576 )
* add filters and tests to db views
* dont federate local only community
* test get apub community http
* tests
* more checks
* wip
* api test
* fix tests
* change community.local_only column to visibility enum
(for private communities)
* sql fmt
* rename vars
* clippy
* fix tests
* update lib
* review
* fix js client version
* update client
2024-01-25 11:04:25 -05:00
e8a52d3a5c
Rewrite images to use local proxy ( #4035 )
...
* Add markdown rule to add rel=nofollow for all links
* Add markdown image rule to add local image proxy (fixes #1036 )
* comments
* rewrite markdown image links working
* add comment
* perform markdown image processing in api/apub receivers
* clippy
* add db table to validate proxied links
* rewrite link fields for avatar, banner etc
* sql fmt
* proxy links received over federation
* add config option
* undo post.url rewriting, move http route definition
* add tests
* proxy images through pictrs
* testing
* cleanup request.rs file
* more cleanup (fixes #2611 )
* include url content type when sending post over apub (fixes #2611 )
* store post url content type in db
* should be media_type
* get rid of cache_remote_thumbnails setting, instead automatically
take thumbnail from federation data if available.
* fix tests
* add setting disable_external_link_previews
* federate post url as image depending on mime type
* change setting again
* machete
* invert
* support custom emoji
* clippy
* update defaults
* add image proxy test, fix test
* fix test
* clippy
* revert accidental changes
* address review
* clippy
* Markdown link rule-dess (#4356 )
* Extracting opengraph_data to its own type.
* A few additions for markdown-link-rule.
---------
Co-authored-by: Nutomic <me@nutomic.com>
* fix setting
* use enum for image proxy setting
* fix test configs
* add config backwards compat
* clippy
* machete
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2024-01-25 09:22:11 -05:00
dullbananas
d8f9e8a64c
Post view: move cursor pagination to separate library, add backward pagination to PostQuery ( #4320 )
...
* stuff
* stuff
* crates.io
* Update up.sql
* Rerun federation tests
* Update post_view.rs
* Update post_view.rs
* Update up.sql
* Update utils.rs
* Fix precision loss
* Update up.sql
* Update down.sql
* remove unwrap
* Update post_view.rs
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2024-01-24 10:50:11 -05:00
dullbananas
759f6d8a9a
Better query plan viewing experience ( #4285 )
...
* stuff
* stuff including batch_upsert function
* stuff
* do things
* stuff
* different timestamps
* stuff
* Revert changes to comment.rs
* Update comment.rs
* Update comment.rs
* Update post_view.rs
* Update utils.rs
* Update up.sql
* Update up.sql
* Update down.sql
* Update up.sql
* Update main.rs
* use anyhow macro
* replace get(0) with first()
* as_slice
* Update series.rs
* Update db_perf.sh
* Update and rename crates/db_schema/src/utils/series.rs to crates/db_perf/src/series.rs
* Update utils.rs
* Update main.rs
* Update main.rs
* Update .woodpecker.yml
* fmt main.rs
* Update .woodpecker.yml
* Instance::delete at end
* Update main.rs
* Update Cargo.toml
---------
Co-authored-by: Nutomic <me@nutomic.com>
2024-01-24 10:22:33 -05:00
0868910570
Add secondary sort by published date for post view ( fixes #4383 ) ( #4384 )
2024-01-22 08:52:21 -05:00
dullbananas
1ef90773e0
Refactor post view tests ( #4313 )
...
* Refactor post view tests
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* remove unused import
2024-01-09 12:19:25 -05:00
38e64825e6
Add macro assert_length!() for tests ( #4348 )
...
* Add macro assert_length!() for tests
* fix
* number
2024-01-04 11:51:55 -05:00
ALEX11BR
a5289dd4cf
Use pretty_assertions
for assertions ( #4347 )
...
* Use `pretty_assertions` for assertions
* fixed ordering of `use`s
* ci
---------
Co-authored-by: Felix Ableitner <me@nutomic.com>
2024-01-04 04:47:18 -05:00
Dessalines
2899ba0131
Fixing broken post_read logic. Fixes #4290 ( #4297 )
2023-12-19 10:46:41 +01:00
dullbananas
a7ba5c9dd3
Sort by post id in post view ( #4270 )
...
* Sort by post id in post view
* Remove tie_breaker
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Nutomic <me@nutomic.com>
2023-12-15 06:42:28 -05:00
Dessalines
246e38a45b
Making login case-insensitive. Fixes #4272 ( #4273 )
...
* Making login case-insensitive. Fixes #4272
* Removing redundant lowercase.
2023-12-15 11:34:17 +01:00
dullbananas
32afc32bc0
Correctly combine sorts in post view cursor-based pagination ( #4247 )
...
* Update post_view.rs
* Update post_view.rs
* Update Cargo.toml
* Update post_view.rs
* fix
* Update post_view.rs
---------
Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2023-12-14 07:10:01 -05:00
dullbananas
5e589004a5
Add test for fixed deleted post filter ( #4256 )
...
* Add test for fixed deleted post filter
* fmt
* Fmt
* Update post_view.rs
2023-12-13 11:09:10 +01:00
dullbananas
a0ef56b9b7
Remove moderator_view field from PostQuery ( #4255 )
2023-12-13 10:52:28 +01:00
Dessalines
f764996745
Show federated posts on user profile. Fixes #4228 ( #4229 )
...
* Show federated posts on user profile. Fixes #4228
* Make sure posts are hidden if no listing_type is given.
2023-12-11 14:36:12 -05:00
Dessalines
6e4278b1c9
Setting rank column defaults to a small number. Fixes #4178 ( #4191 )
...
* Setting rank column defaults to a small number. Fixes #4178
* Fixing tests.
2023-11-23 20:39:46 -05:00
26297b4035
Users can view their own posts after removal ( fixes #4186 ) ( #4192 )
2023-11-23 09:47:49 -05:00
e58a167d64
Fix remote community posts appearing in local listing ( fixes #4180 ) ( #4181 )
...
* Fix remote community posts appearing in local listing (fixes #4180 )
* fmt
* fix typo
2023-11-22 09:41:52 -05:00
Dessalines
3e1f7f2efa
Adding creator_is_admin
to PersonView
, CommentView
, and PostView
. ( #4165 )
...
* Adding creator_is_admin to PersonView, CommentView, and PostView.
* Removing left joins from comment_view.
* Removing joins from person_mention and comment_reply views.
* Removing extra left join from person_view.
* Reverting some changes in post_view.
* Fixing compile error.
2023-11-21 11:20:24 -05:00
49377c195e
Fix deleted posts so they can only be seen by creator ( #4182 )
2023-11-21 08:59:47 -05:00
dullbananas
8e2cbc9a0f
Remove id column and use different primary key on some tables ( #4093 )
...
* post_saved
* fmt
* remove unique and not null
* put person_id first in primary key and remove index
* use post_saved.find
* change captcha_answer
* remove removal of not null
* comment_aggregates
* comment_like
* comment_saved
* aggregates
* remove "\"
* deduplicate site_aggregates
* person_post_aggregates
* community_moderator
* community_block
* community_person_ban
* custom_emoji_keyword
* federation allow/block list
* federation_queue_state
* instance_block
* local_site_rate_limit, local_user_language, login_token
* person_ban, person_block, person_follower, post_like, post_read, received_activity
* community_follower, community_language, site_language
* fmt
* image_upload
* remove unused newtypes
* remove more indexes
* use .find
* merge
* fix site_aggregates_site function
* fmt
* Primary keys dess (#17 )
* Also order reports by oldest first (ref #4123 ) (#4129 )
* Support signed fetch for federation (fixes #868 ) (#4125 )
* Support signed fetch for federation (fixes #868 )
* taplo
* add federation queue state to get_federated_instances api (#4104 )
* add federation queue state to get_federated_instances api
* feature gate
* move retry sleep function
* move stuff around
* Add UI setting for collapsing bot comments. Fixes #3838 (#4098 )
* Add UI setting for collapsing bot comments. Fixes #3838
* Fixing clippy check.
* Only keep sent and received activities for 7 days (fixes #4113 , fixes #4110 ) (#4131 )
* Only check auth secure on release mode. (#4127 )
* Only check auth secure on release mode.
* Fixing wrong js-client.
* Adding is_debug_mode var.
* Fixing the desktop image on the README. (#4135 )
* Delete dupes and add possibly missing unique constraint on person_aggregates.
* Fixing clippy lints.
---------
Co-authored-by: Nutomic <me@nutomic.com>
Co-authored-by: phiresky <phireskyde+git@gmail.com>
* fmt
* Update community_block.rs
* Update instance_block.rs
* Update person_block.rs
* Update person_block.rs
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Nutomic <me@nutomic.com>
Co-authored-by: phiresky <phireskyde+git@gmail.com>
2023-11-13 08:14:07 -05:00
Dessalines
5d48ee3dc8
Add creator_is_moderator to Comment and PostViews. Fixes #3347 ( #4087 )
...
* Add creator_is_moderator to Comment and PostViews. Fixes #3347
* Fixing community_moderator join.
* Addressing PR comments.
2023-10-24 08:37:03 -04:00
Dessalines
5bfa4e9358
Make sure my_vote is consistently missing if not voted. Fixes #3197 ( #4075 )
...
* Make sure my_vote is consistently missing if not voted. Fixes #3197
* Fix clippy.
* Fix tests.
2023-10-23 12:40:29 -04:00
Maxime Poulin
3a1be8c041
Fix legacy pagination for Subscribed feed ( #4030 )
...
This is the fix suggested in #4019
I've manually tested both legacy pagination (`page=2&limit=20`) as well as the new pagination (`cursor_next=XXXXXXX&limit=20`) using the same endpoint as #4019 , and both methods appear to work as expected.
2023-10-11 16:53:18 +02:00
50f81cf157
User can block instances ( fixes #2397 ) ( #3869 )
...
* User can block instances (fixes #2397 )
* update comments
* review comments
* use route
* update
* add api test
* update tests
* fix
* fix test
* ci
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2023-09-20 11:56:13 +02:00
phiresky
544d30f0d4
Fix Posts List Performance + cursor-based pagination ( #3872 )
...
* add token-based pagination + fast subscribed post view
* add migrations
* fix failing heuristic
* revert
* output pagination token as next_page, fix off-by-one, restructure
* more cleanup
* clean
* format sql
* fix comment
* fix tests
* e
* empty
* move last page thing
* restructure a bit for readability
* rename page_cursor
* update for scaled sort
* fix
* sql format
* fix
* get rid of macros
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2023-09-18 15:44:48 +02:00
Dessalines
9785b20843
Adding a scaled sort, to boost smaller communities. ( #3907 )
...
* Adding a scaled sort, to boost smaller communities.
- Previously referred to as *best* .
- Fixes #3622
* Fixing scheduled task update.
* Converting hot_rank integers to floats.
* Altering hot_rank psql function to default to zero after a week.
* Setting scaled_rank to zero, where hot_rank is zero.
* Adding image_upload table.
2023-09-06 13:43:27 -04:00
dullbananas
5b5ac0f37d
Remove left joins and use only one call to select method in post_view.rs ( #3865 )
...
* Use same joins for read and list in post_view.rs
* fmt
* rerun ci
* rerun ci
* Update post_view.rs
* rerun ci
* rerun ci
* Update post_view.rs
* Use `exists`
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* rerun ci
* Update post_view.rs
* person_id_join parameter
* rerun ci
* fmt
* Update post_view.rs
* rerun ci
* Update post_view.rs
* rerun ci
* fmt
* Update post_view.rs
* fmt
* Use into_sql
* Update post_view.rs
* Use inferred query source for BoxableExpression
* Update post_view.rs
* Update post_view.rs
* Update community.rs
* Update community.rs
* Update post_view.rs
* fmt
* Update community.rs
* Update community.rs
* Update community.rs
* Update community.rs
* Update community.rs
* Update post_view.rs
* Update community.rs
* fmt
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* Update post_view.rs
* fmt
* Update post_view.rs
* Update post_view.rs
* fix
* trigger ci
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: phiresky <phireskyde+git@gmail.com>
2023-09-04 11:05:00 +02:00
dullbananas
15930cbf4d
Use Queryable instead of JoinView ( #3917 )
...
* Update utils.rs
* Update traits.rs
* Update comment_report_view.rs
* Update comment_view.rs
* Update local_user_view.rs
* Update post_report_view.rs
* Update post_view.rs
* Update private_message_report_view.rs
* Update private_message_view.rs
* Update registration_application_view.rs
* Update site_view.rs
* Update structs.rs
* Update comment_reply_view.rs
* Update community_block_view.rs
* Update community_follower_view.rs
* Update community_moderator_view.rs
* Update community_person_ban_view.rs
* Update community_person_ban_view.rs
* Update community_view.rs
* Update person_block_view.rs
* Update person_mention_view.rs
* Update person_view.rs
* Update structs.rs
* Update admin_purge_comment_view.rs
* Update admin_purge_community_view.rs
* Update admin_purge_person_view.rs
* Update admin_purge_post_view.rs
* Update mod_add_community_view.rs
* Update mod_add_view.rs
* Update mod_ban_from_community_view.rs
* Update mod_ban_view.rs
* Update mod_feature_post_view.rs
* Update mod_hide_community_view.rs
* Update mod_lock_post_view.rs
* Update mod_remove_comment_view.rs
* Update mod_remove_community_view.rs
* Update mod_remove_post_view.rs
* Update mod_transfer_community_view.rs
* Update structs.rs
* Update utils.rs
* Update private_message_view.rs
* Update comment_report_view.rs
* Update registration_application_view.rs
* Update utils.rs
* fix
* fix db_views
* fix
* Update comment_view.rs
2023-08-31 15:26:10 +02:00
biosfood
384e55f0e4
update moderator view ( #3820 )
...
* update api tests for new moderator view
* chage moderator view to be a listing type in get posts
Note: Internally, the listing type is called ListingType.ModeratorView,
but it's called "Moderator View" in the api endpoint
* fix formatting
* add support for moderator view to list comments
* add api test for moderator view when listing comments
* fix api test formatting
* retry tests
* don't filter out blocked users and communities when using moderator view
* fix cargo tests failing
* fix formatting
* fix previous merge
* Adding ModeratorView to listing_type_enums
* Fixing fmt.
* Adding a default to ListingType.
* Upgrading to use new lemmy-js-client.
---------
Co-authored-by: Nutomic <me@nutomic.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
Co-authored-by: Dessalines <tyhou13@gmx.com>
2023-08-31 13:07:45 +02:00
phiresky
514f2222e0
Fix time zone handling ( #3496 )
...
* convert naive time to utc time
* compounding fixes
* cargo fmt
* fix the rest
* fix down migration
* fix migrations
* fix after merge
* clippy fix
* ap-fed 0.5.0
---------
Co-authored-by: Nutomic <me@nutomic.com>
2023-08-24 11:27:00 -04:00
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