mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-03 03:33:50 +00:00
Splitting DB_views into separate crates. (#5617)
* 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 * Adding a first_id helper function. * Fixing api_common * Addressing PR comments * Views to workspace, halfway done. * More views done. * Finishing up views * Running cargo shear. * taplo fmt. * cargo fmt * Remove empty files * Splitting out combined views. * Fixing api_common diesel * taplo * Fixing imports for api_common * 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. --------- Co-authored-by: Felix Ableitner <me@nutomic.com> Co-authored-by: dullbananas <dull.bananas0@gmail.com>
This commit is contained in:
parent
ed5a3831aa
commit
fe50d8ad67
266 changed files with 3991 additions and 2248 deletions
420
Cargo.lock
generated
420
Cargo.lock
generated
|
@ -3120,7 +3120,23 @@ dependencies = [
|
|||
"lemmy_api_crud",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_community_person_ban",
|
||||
"lemmy_db_views_inbox_combined",
|
||||
"lemmy_db_views_local_image",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_modlog_combined",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_person_saved_combined",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_db_views_registration_applications",
|
||||
"lemmy_db_views_report_combined",
|
||||
"lemmy_db_views_reports",
|
||||
"lemmy_db_views_site",
|
||||
"lemmy_db_views_vote",
|
||||
"lemmy_email",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
|
@ -3151,7 +3167,27 @@ dependencies = [
|
|||
"jsonwebtoken",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_community_person_ban",
|
||||
"lemmy_db_views_custom_emoji",
|
||||
"lemmy_db_views_inbox_combined",
|
||||
"lemmy_db_views_local_image",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_modlog_combined",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_person_content_combined",
|
||||
"lemmy_db_views_person_saved_combined",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_db_views_private_message",
|
||||
"lemmy_db_views_registration_applications",
|
||||
"lemmy_db_views_report_combined",
|
||||
"lemmy_db_views_reports",
|
||||
"lemmy_db_views_search_combined",
|
||||
"lemmy_db_views_site",
|
||||
"lemmy_db_views_vote",
|
||||
"lemmy_email",
|
||||
"lemmy_utils",
|
||||
"mime",
|
||||
|
@ -3191,7 +3227,17 @@ dependencies = [
|
|||
"lemmy_api_common",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_custom_emoji",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_db_views_private_message",
|
||||
"lemmy_db_views_search_combined",
|
||||
"lemmy_db_views_site",
|
||||
"lemmy_email",
|
||||
"lemmy_utils",
|
||||
"regex",
|
||||
|
@ -3223,7 +3269,18 @@ dependencies = [
|
|||
"lemmy_api_common",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_community_person_ban",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_person_content_combined",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_db_views_private_message",
|
||||
"lemmy_db_views_search_combined",
|
||||
"lemmy_db_views_site",
|
||||
"lemmy_utils",
|
||||
"moka",
|
||||
"pretty_assertions",
|
||||
|
@ -3250,7 +3307,7 @@ dependencies = [
|
|||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_utils",
|
||||
"tokio",
|
||||
"url",
|
||||
|
@ -3311,22 +3368,235 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views"
|
||||
name = "lemmy_db_views_comment"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"chrono",
|
||||
"derive-new",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"diesel_ltree",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_community"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_community_follower"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_community_moderator"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_community_person_ban"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_custom_emoji"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_inbox_combined"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_private_message",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_local_image"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_local_user"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_modlog_combined"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_person"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_person_content_combined"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"derive-new",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_person_saved_combined"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_post"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"serial_test",
|
||||
"test-context",
|
||||
|
@ -3336,6 +3606,125 @@ dependencies = [
|
|||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_private_message"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_registration_applications"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_report_combined"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_reports",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_reports"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_search_combined"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_site"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_vote"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"serial_test",
|
||||
"tokio",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_email"
|
||||
version = "1.0.0-alpha.4"
|
||||
|
@ -3343,7 +3732,7 @@ dependencies = [
|
|||
"html2text",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_utils",
|
||||
"lettre",
|
||||
"rosetta-build",
|
||||
|
@ -3367,7 +3756,7 @@ dependencies = [
|
|||
"lemmy_apub",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_utils",
|
||||
"mockall",
|
||||
"moka",
|
||||
|
@ -3402,7 +3791,11 @@ dependencies = [
|
|||
"lemmy_api_common",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_inbox_combined",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_person_content_combined",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_db_views_site",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"prometheus",
|
||||
|
@ -3429,6 +3822,7 @@ dependencies = [
|
|||
"lemmy_apub",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_site",
|
||||
"lemmy_federate",
|
||||
"lemmy_routes",
|
||||
"lemmy_utils",
|
||||
|
|
46
Cargo.toml
46
Cargo.toml
|
@ -39,6 +39,7 @@ debug = 0
|
|||
default = []
|
||||
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"crates/api",
|
||||
"crates/api_crud",
|
||||
|
@ -48,7 +49,27 @@ members = [
|
|||
"crates/db_perf",
|
||||
"crates/db_schema",
|
||||
"crates/db_schema_file",
|
||||
"crates/db_views",
|
||||
"crates/db_views_private_message",
|
||||
"crates/db_views_local_user",
|
||||
"crates/db_views_local_image",
|
||||
"crates/db_views_person",
|
||||
"crates/db_views_post",
|
||||
"crates/db_views_vote",
|
||||
"crates/db_views_reports",
|
||||
"crates/db_views_local_image",
|
||||
"crates/db_views_comment",
|
||||
"crates/db_views_community",
|
||||
"crates/db_views_community_moderator",
|
||||
"crates/db_views_community_follower",
|
||||
"crates/db_views_community_person_ban",
|
||||
"crates/db_views_custom_emoji",
|
||||
"crates/db_views_inbox_combined",
|
||||
"crates/db_views_modlog_combined",
|
||||
"crates/db_views_person_content_combined",
|
||||
"crates/db_views_person_saved_combined",
|
||||
"crates/db_views_report_combined",
|
||||
"crates/db_views_search_combined",
|
||||
"crates/db_views_site",
|
||||
"crates/routes",
|
||||
"crates/federate",
|
||||
"crates/email",
|
||||
|
@ -89,9 +110,29 @@ lemmy_db_schema = { version = "=1.0.0-alpha.4", path = "./crates/db_schema" }
|
|||
lemmy_db_schema_file = { version = "=1.0.0-alpha.4", path = "./crates/db_schema_file" }
|
||||
lemmy_api_common = { version = "=1.0.0-alpha.4", path = "./crates/api_common" }
|
||||
lemmy_routes = { version = "=1.0.0-alpha.4", path = "./crates/routes" }
|
||||
lemmy_db_views = { version = "=1.0.0-alpha.4", path = "./crates/db_views" }
|
||||
lemmy_federate = { version = "=1.0.0-alpha.4", path = "./crates/federate" }
|
||||
lemmy_email = { version = "=1.0.0-alpha.4", path = "./crates/email" }
|
||||
lemmy_db_views_private_message = { version = "=1.0.0-alpha.4", path = "./crates/db_views_private_message" }
|
||||
lemmy_db_views_registration_applications = { version = "=1.0.0-alpha.4", path = "./crates/db_views_registration_applications" }
|
||||
lemmy_db_views_comment = { version = "=1.0.0-alpha.4", path = "./crates/db_views_comment" }
|
||||
lemmy_db_views_local_user = { version = "=1.0.0-alpha.4", path = "./crates/db_views_local_user" }
|
||||
lemmy_db_views_person = { version = "=1.0.0-alpha.4", path = "./crates/db_views_person" }
|
||||
lemmy_db_views_custom_emoji = { version = "=1.0.0-alpha.4", path = "./crates/db_views_custom_emoji" }
|
||||
lemmy_db_views_post = { version = "=1.0.0-alpha.4", path = "./crates/db_views_post" }
|
||||
lemmy_db_views_vote = { version = "=1.0.0-alpha.4", path = "./crates/db_views_vote" }
|
||||
lemmy_db_views_community = { version = "=1.0.0-alpha.4", path = "./crates/db_views_community" }
|
||||
lemmy_db_views_community_moderator = { version = "=1.0.0-alpha.4", path = "./crates/db_views_community_moderator" }
|
||||
lemmy_db_views_community_follower = { version = "=1.0.0-alpha.4", path = "./crates/db_views_community_follower" }
|
||||
lemmy_db_views_community_person_ban = { version = "=1.0.0-alpha.4", path = "./crates/db_views_community_person_ban" }
|
||||
lemmy_db_views_reports = { version = "=1.0.0-alpha.4", path = "./crates/db_views_reports" }
|
||||
lemmy_db_views_local_image = { version = "=1.0.0-alpha.4", path = "./crates/db_views_local_image" }
|
||||
lemmy_db_views_inbox_combined = { version = "=1.0.0-alpha.4", path = "./crates/db_views_inbox_combined" }
|
||||
lemmy_db_views_modlog_combined = { version = "=1.0.0-alpha.4", path = "./crates/db_views_modlog_combined" }
|
||||
lemmy_db_views_person_content_combined = { version = "=1.0.0-alpha.4", path = "./crates/db_views_person_content_combined" }
|
||||
lemmy_db_views_person_saved_combined = { version = "=1.0.0-alpha.4", path = "./crates/db_views_person_saved_combined" }
|
||||
lemmy_db_views_report_combined = { version = "=1.0.0-alpha.4", path = "./crates/db_views_report_combined" }
|
||||
lemmy_db_views_search_combined = { version = "=1.0.0-alpha.4", path = "./crates/db_views_search_combined" }
|
||||
lemmy_db_views_site = { version = "=1.0.0-alpha.4", path = "./crates/db_views_site" }
|
||||
activitypub_federation = { version = "0.6.3", default-features = false, features = [
|
||||
"actix-web",
|
||||
] }
|
||||
|
@ -177,6 +218,7 @@ lemmy_db_schema_file = { workspace = true }
|
|||
lemmy_api_common = { workspace = true }
|
||||
lemmy_routes = { workspace = true }
|
||||
lemmy_federate = { workspace = true }
|
||||
lemmy_db_views_site = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
actix-web = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
|
|
@ -18,9 +18,27 @@ doctest = false
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_comment = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_moderator = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_follower = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_person_ban = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_post = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_vote = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_local_user = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_person = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_reports = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_local_image = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_inbox_combined = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_modlog_combined = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_person_saved_combined = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_report_combined = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_site = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_registration_applications = { workspace = true, features = [
|
||||
"full",
|
||||
] }
|
||||
lemmy_utils = { workspace = true }
|
||||
lemmy_db_schema = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_email = { workspace = true }
|
||||
|
|
|
@ -10,7 +10,8 @@ use lemmy_db_schema::{
|
|||
source::comment::{Comment, CommentUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn distinguish_comment(
|
||||
|
|
|
@ -16,7 +16,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Likeable,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView, SiteView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use std::ops::Deref;
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ use lemmy_api_common::{
|
|||
context::LemmyContext,
|
||||
utils::is_mod_or_admin,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView, VoteView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_vote::VoteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Lists likes for a comment
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_db_schema::{
|
|||
source::comment::{CommentActions, CommentSavedForm},
|
||||
traits::Saveable,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn save_comment(
|
||||
|
|
|
@ -16,7 +16,8 @@ use lemmy_db_schema::{
|
|||
traits::{Crud, Joinable},
|
||||
utils::get_conn,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityModeratorView, LocalUserView};
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyError, LemmyResult};
|
||||
|
||||
pub async fn add_mod_to_community(
|
||||
|
|
|
@ -20,7 +20,8 @@ use lemmy_db_schema::{
|
|||
traits::{Bannable, Crud, Followable},
|
||||
utils::get_conn,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PersonView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyError, LemmyResult},
|
||||
utils::validation::is_valid_body_field,
|
||||
|
|
|
@ -11,7 +11,8 @@ use lemmy_db_schema::{
|
|||
traits::{Blockable, Followable},
|
||||
utils::get_conn,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityView, LocalUserView};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyError, LemmyResult};
|
||||
|
||||
pub async fn user_block_community(
|
||||
|
|
|
@ -14,7 +14,9 @@ use lemmy_db_schema::{
|
|||
traits::{Crud, Followable},
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommunityFollowerState, CommunityVisibility};
|
||||
use lemmy_db_views::structs::{CommunityPersonBanView, CommunityView, LocalUserView};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_community_person_ban::CommunityPersonBanView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn follow_community(
|
||||
|
|
|
@ -8,7 +8,7 @@ use lemmy_api_common::{
|
|||
SuccessResponse,
|
||||
};
|
||||
use lemmy_db_schema::{source::community::CommunityActions, traits::Followable};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn post_pending_follows_approve(
|
||||
|
|
|
@ -4,7 +4,8 @@ use lemmy_api_common::{
|
|||
context::LemmyContext,
|
||||
utils::is_mod_or_admin,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityFollowerView, LocalUserView};
|
||||
use lemmy_db_views_community_follower::CommunityFollowerView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_pending_follows_count(
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
utils::check_community_mod_of_any_or_admin_action,
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::structs::{CommunityFollowerView, LocalUserView, PendingFollow};
|
||||
use lemmy_db_views_community_follower::{CommunityFollowerView, PendingFollow};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_pending_follows_list(
|
||||
|
|
|
@ -6,7 +6,9 @@ use lemmy_api_common::{
|
|||
utils::{check_private_instance, is_mod_or_admin_opt},
|
||||
};
|
||||
use lemmy_db_schema::source::{actor_language::CommunityLanguage, community::Community};
|
||||
use lemmy_db_views::structs::{CommunityView, LocalUserView, SiteView};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_random_community(
|
||||
|
|
|
@ -13,7 +13,7 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::{error::LemmyResult, utils::validation::tag_name_length_check};
|
||||
|
||||
pub async fn create_community_tag(
|
||||
|
|
|
@ -14,7 +14,9 @@ use lemmy_db_schema::{
|
|||
traits::{Crud, Joinable},
|
||||
utils::get_conn,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityModeratorView, CommunityView, LocalUserView};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyError, LemmyErrorType, LemmyResult},
|
||||
location_info,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use base64::{engine::general_purpose::STANDARD_NO_PAD as base64, Engine};
|
||||
use captcha::Captcha;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
utils::slurs::check_slurs,
|
||||
|
|
|
@ -11,7 +11,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::{person::person_view::PersonQuery, structs::LocalUserView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::impls::PersonQuery;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn add_admin(
|
||||
|
|
|
@ -15,7 +15,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::{Bannable, Crud},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PersonView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_utils::{error::LemmyResult, utils::validation::is_valid_body_field};
|
||||
|
||||
pub async fn ban_from_site(
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_db_schema::{
|
|||
source::person::{PersonActions, PersonBlockForm},
|
||||
traits::Blockable,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PersonView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn user_block_person(
|
||||
|
|
|
@ -10,7 +10,7 @@ use lemmy_api_common::{
|
|||
utils::password_length_check,
|
||||
};
|
||||
use lemmy_db_schema::source::{local_user::LocalUser, login_token::LoginToken};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn change_password(
|
||||
|
|
|
@ -2,7 +2,7 @@ use actix_web::web::{Data, Json};
|
|||
use chrono::Utc;
|
||||
use lemmy_api_common::{context::LemmyContext, SuccessResponse};
|
||||
use lemmy_db_schema::source::local_user::{LocalUser, LocalUserUpdateForm};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn donation_dialog_shown(
|
||||
|
|
|
@ -6,7 +6,7 @@ use lemmy_db_schema::source::{
|
|||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
site::Site,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
/// Generate a new secret for two-factor-authentication. Afterwards you need to call [toggle_totp]
|
||||
|
|
|
@ -15,7 +15,7 @@ use lemmy_api_common::{
|
|||
LemmyErrorType,
|
||||
};
|
||||
use lemmy_db_schema::source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm};
|
||||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_captcha(context: Data<LemmyContext>) -> LemmyResult<HttpResponse> {
|
||||
|
|
|
@ -5,10 +5,8 @@ use lemmy_api_common::{
|
|||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::{
|
||||
person::person_view::PersonQuery,
|
||||
structs::{LocalUserView, PersonView},
|
||||
};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::{impls::PersonQuery, PersonView};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_banned_users(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_common::{context::LemmyContext, person::ListLoginsResponse};
|
||||
use lemmy_db_schema::source::login_token::LoginToken;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_logins(
|
||||
|
|
|
@ -4,7 +4,8 @@ use lemmy_api_common::{
|
|||
person::{ListMedia, ListMediaResponse},
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::structs::{LocalImageView, LocalUserView};
|
||||
use lemmy_db_views_local_image::LocalImageView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_media(
|
||||
|
|
|
@ -6,10 +6,12 @@ use lemmy_api_common::{
|
|||
utils::check_private_instance,
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::{
|
||||
combined::person_saved_combined_view::PersonSavedCombinedQuery,
|
||||
structs::{LocalUserView, PersonSavedCombinedView, SiteView},
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person_saved_combined::{
|
||||
impls::PersonSavedCombinedQuery,
|
||||
PersonSavedCombinedView,
|
||||
};
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_person_saved(
|
||||
|
|
|
@ -10,7 +10,8 @@ use lemmy_api_common::{
|
|||
person::{Login, LoginResponse},
|
||||
utils::{check_email_verified, check_local_user_valid, check_registration_application},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn login(
|
||||
|
|
|
@ -6,7 +6,7 @@ use lemmy_api_common::{
|
|||
SuccessResponse,
|
||||
};
|
||||
use lemmy_db_schema::source::login_token::LoginToken;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn logout(
|
||||
|
|
|
@ -4,10 +4,8 @@ use lemmy_api_common::{
|
|||
person::{ListInbox, ListInboxResponse},
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::{
|
||||
combined::inbox_combined_view::InboxCombinedQuery,
|
||||
structs::{InboxCombinedView, LocalUserView},
|
||||
};
|
||||
use lemmy_db_views_inbox_combined::{impls::InboxCombinedQuery, InboxCombinedView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_inbox(
|
||||
|
|
|
@ -6,7 +6,7 @@ use lemmy_db_schema::source::{
|
|||
person_post_mention::PersonPostMention,
|
||||
private_message::PrivateMessage,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn mark_all_notifications_read(
|
||||
|
|
|
@ -8,7 +8,7 @@ use lemmy_db_schema::{
|
|||
source::person_comment_mention::{PersonCommentMention, PersonCommentMentionUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_comment_mention_as_read(
|
||||
|
|
|
@ -8,7 +8,7 @@ use lemmy_db_schema::{
|
|||
source::person_post_mention::{PersonPostMention, PersonPostMentionUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_post_mention_as_read(
|
||||
|
|
|
@ -4,7 +4,7 @@ use lemmy_db_schema::{
|
|||
source::comment_reply::{CommentReply, CommentReplyUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_reply_as_read(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_common::{context::LemmyContext, person::GetUnreadCountResponse};
|
||||
use lemmy_db_views::structs::{InboxCombinedViewInternal, LocalUserView};
|
||||
use lemmy_db_views_inbox_combined::InboxCombinedViewInternal;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn unread_count(
|
||||
|
|
|
@ -4,7 +4,8 @@ use lemmy_api_common::{
|
|||
person::{GetReportCount, GetReportCountResponse},
|
||||
utils::check_community_mod_of_any_or_admin_action,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, ReportCombinedViewInternal};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_report_combined::ReportCombinedViewInternal;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn report_count(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_common::{context::LemmyContext, person::ResendVerificationEmail, SuccessResponse};
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::account::send_verification_email_if_required;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
utils::check_email_verified,
|
||||
SuccessResponse,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::account::send_password_reset_email;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use tracing::error;
|
||||
|
|
|
@ -16,7 +16,8 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
utils::{diesel_opt_number_update, diesel_string_update},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::account::send_verification_email;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
|
|
|
@ -5,7 +5,7 @@ use lemmy_api_common::{
|
|||
person::{UpdateTotp, UpdateTotpResponse},
|
||||
};
|
||||
use lemmy_db_schema::source::local_user::{LocalUser, LocalUserUpdateForm};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Enable or disable two-factor-authentication. The current setting is determined from
|
||||
|
|
|
@ -5,7 +5,7 @@ use lemmy_db_schema::{
|
|||
source::instance::{InstanceActions, InstanceBlockForm},
|
||||
traits::Blockable,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn user_block_instance(
|
||||
|
|
|
@ -4,7 +4,8 @@ use lemmy_db_schema::source::{
|
|||
email_verification::EmailVerification,
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::{account::send_email_verified_email, admin::send_new_applicant_email_to_admins};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
PostFeatureType,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn feature_post(
|
||||
|
|
|
@ -4,7 +4,7 @@ use lemmy_api_common::{
|
|||
post::{GetSiteMetadata, GetSiteMetadataResponse},
|
||||
request::fetch_link_metadata,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
use url::Url;
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_db_schema::{
|
|||
source::post::{PostActions, PostHideForm},
|
||||
traits::Hideable,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn hide_post(
|
||||
|
|
|
@ -13,7 +13,9 @@ use lemmy_db_schema::{
|
|||
source::post::{PostActions, PostLikeForm, PostReadForm},
|
||||
traits::{Likeable, Readable},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use std::ops::Deref;
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
utils::is_mod_or_admin,
|
||||
};
|
||||
use lemmy_db_schema::{source::post::Post, traits::Crud};
|
||||
use lemmy_db_views::structs::{LocalUserView, VoteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_vote::VoteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Lists likes for a post
|
||||
|
|
|
@ -14,7 +14,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn lock_post(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_common::{context::LemmyContext, post::MarkManyPostsAsRead, SuccessResponse};
|
||||
use lemmy_db_schema::{source::post::PostActions, traits::Readable};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS};
|
||||
|
||||
pub async fn mark_posts_as_read(
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_db_schema::{
|
|||
source::post::{PostActions, PostReadForm},
|
||||
traits::Readable,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn mark_post_as_read(
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_db_schema::{
|
|||
source::post::{PostActions, PostReadForm, PostSavedForm},
|
||||
traits::{Readable, Saveable},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn save_post(
|
||||
|
|
|
@ -8,7 +8,7 @@ use lemmy_db_schema::{
|
|||
source::private_message::{PrivateMessage, PrivateMessageUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_pm_as_read(
|
||||
|
|
|
@ -11,7 +11,10 @@ use lemmy_db_schema::{
|
|||
source::comment_report::{CommentReport, CommentReportForm},
|
||||
traits::Reportable,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentReportView, CommentView, LocalUserView, SiteView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::CommentReportView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::admin::send_new_report_email_to_admins;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_api_common::{
|
|||
utils::check_community_mod_action,
|
||||
};
|
||||
use lemmy_db_schema::{source::comment_report::CommentReport, traits::Reportable};
|
||||
use lemmy_db_views::structs::{CommentReportView, LocalUserView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::CommentReportView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Resolves or unresolves a comment report and notifies the moderators of the community
|
||||
|
|
|
@ -12,7 +12,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::{Crud, Reportable},
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityReportView, LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::CommunityReportView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::admin::send_new_report_email_to_admins;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_schema::{source::community_report::CommunityReport, traits::Reportable};
|
||||
use lemmy_db_views::structs::{CommunityReportView, LocalUserView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::CommunityReportView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn resolve_community_report(
|
||||
|
|
|
@ -11,7 +11,10 @@ use lemmy_db_schema::{
|
|||
source::post_report::{PostReport, PostReportForm},
|
||||
traits::Reportable,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostReportView, PostView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_reports::PostReportView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::admin::send_new_report_email_to_admins;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_api_common::{
|
|||
utils::check_community_mod_action,
|
||||
};
|
||||
use lemmy_db_schema::{source::post_report::PostReport, traits::Reportable};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostReportView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::PostReportView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Resolves or unresolves a post report and notifies the moderators of the community
|
||||
|
|
|
@ -12,7 +12,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::{Crud, Reportable},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PrivateMessageReportView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::PrivateMessageReportView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_email::admin::send_new_report_email_to_admins;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_schema::{source::private_message_report::PrivateMessageReport, traits::Reportable};
|
||||
use lemmy_db_views::structs::{LocalUserView, PrivateMessageReportView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_reports::PrivateMessageReportView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn resolve_pm_report(
|
||||
|
|
|
@ -5,10 +5,8 @@ use lemmy_api_common::{
|
|||
utils::check_community_mod_of_any_or_admin_action,
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::{
|
||||
combined::report_combined_view::ReportCombinedQuery,
|
||||
structs::{LocalUserView, ReportCombinedView},
|
||||
};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_report_combined::{impls::ReportCombinedQuery, ReportCombinedView};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Lists reports for a community if an id is supplied
|
||||
|
|
|
@ -15,7 +15,7 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn admin_allow_instance(
|
||||
|
|
|
@ -15,7 +15,7 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn admin_block_instance(
|
||||
|
|
|
@ -4,7 +4,7 @@ use lemmy_api_common::{
|
|||
site::GetFederatedInstancesResponse,
|
||||
utils::build_federated_instances,
|
||||
};
|
||||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_federated_instances(
|
||||
|
|
|
@ -12,10 +12,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::{
|
||||
person::person_view::PersonQuery,
|
||||
structs::{LocalUserView, SiteView},
|
||||
};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::impls::PersonQuery;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
VERSION,
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::structs::{LocalImageView, LocalUserView};
|
||||
use lemmy_db_views_local_image::LocalImageView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_all_media(
|
||||
|
|
|
@ -5,10 +5,9 @@ use lemmy_api_common::{
|
|||
utils::{check_community_mod_of_any_or_admin_action, check_private_instance},
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::{
|
||||
combined::modlog_combined_view::ModlogCombinedQuery,
|
||||
structs::{LocalUserView, ModlogCombinedView, SiteView},
|
||||
};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_modlog_combined::{impls::ModlogCombinedQuery, ModlogCombinedView};
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_mod_log(
|
||||
|
|
|
@ -15,7 +15,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_comment(
|
||||
|
|
|
@ -16,7 +16,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityModeratorView, LocalUserView};
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_community(
|
||||
|
|
|
@ -16,7 +16,7 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::{Bannable, Crud},
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_person(
|
||||
|
|
|
@ -15,7 +15,7 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_post(
|
||||
|
|
|
@ -14,7 +14,8 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
utils::{diesel_string_update, get_conn},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_registration_applications::RegistrationApplicationView;
|
||||
use lemmy_email::account::{send_application_approved_email, send_application_denied_email};
|
||||
use lemmy_utils::error::{LemmyError, LemmyResult};
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ use lemmy_api_common::{
|
|||
site::{GetRegistrationApplication, RegistrationApplicationResponse},
|
||||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_registration_applications::RegistrationApplicationView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Lists registration applications, filterable by undenied only.
|
||||
|
|
|
@ -6,10 +6,12 @@ use lemmy_api_common::{
|
|||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_schema::traits::PaginationCursorBuilder;
|
||||
use lemmy_db_views::{
|
||||
registration_applications::registration_application_view::RegistrationApplicationQuery,
|
||||
structs::{LocalUserView, RegistrationApplicationView, SiteView},
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_registration_applications::{
|
||||
impls::RegistrationApplicationQuery,
|
||||
RegistrationApplicationView,
|
||||
};
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Lists registration applications, filterable by undenied only.
|
||||
|
|
|
@ -30,7 +30,7 @@ use lemmy_db_schema::{
|
|||
utils::DbPool,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::RegistrationMode;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
CACHE_DURATION_API,
|
||||
|
|
|
@ -5,7 +5,9 @@ use lemmy_api_common::{
|
|||
site::GetUnreadRegistrationApplicationCountResponse,
|
||||
utils::is_admin,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_registration_applications::RegistrationApplicationView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_unread_registration_application_count(
|
||||
|
|
|
@ -19,9 +19,6 @@ workspace = true
|
|||
[features]
|
||||
full = [
|
||||
"tracing",
|
||||
"lemmy_db_views/full",
|
||||
"lemmy_utils/full",
|
||||
"lemmy_email",
|
||||
"activitypub_federation",
|
||||
"encoding_rs",
|
||||
"reqwest-middleware",
|
||||
|
@ -40,11 +37,55 @@ full = [
|
|||
"extism-convert",
|
||||
"once_cell",
|
||||
"serde_json",
|
||||
"lemmy_email",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_utils/full",
|
||||
"lemmy_db_views_comment/full",
|
||||
"lemmy_db_views_community/full",
|
||||
"lemmy_db_views_community_moderator/full",
|
||||
"lemmy_db_views_community_follower/full",
|
||||
"lemmy_db_views_community_person_ban/full",
|
||||
"lemmy_db_views_post/full",
|
||||
"lemmy_db_views_vote/full",
|
||||
"lemmy_db_views_local_user/full",
|
||||
"lemmy_db_views_person/full",
|
||||
"lemmy_db_views_custom_emoji/full",
|
||||
"lemmy_db_views_reports/full",
|
||||
"lemmy_db_views_private_message/full",
|
||||
"lemmy_db_views_local_image/full",
|
||||
"lemmy_db_views_inbox_combined/full",
|
||||
"lemmy_db_views_modlog_combined/full",
|
||||
"lemmy_db_views_person_content_combined/full",
|
||||
"lemmy_db_views_person_saved_combined/full",
|
||||
"lemmy_db_views_report_combined/full",
|
||||
"lemmy_db_views_search_combined/full",
|
||||
"lemmy_db_views_site/full",
|
||||
"lemmy_db_views_registration_applications/full",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views = { workspace = true }
|
||||
lemmy_db_views_comment = { workspace = true }
|
||||
lemmy_db_views_community = { workspace = true }
|
||||
lemmy_db_views_community_moderator = { workspace = true }
|
||||
lemmy_db_views_community_follower = { workspace = true }
|
||||
lemmy_db_views_community_person_ban = { workspace = true }
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
lemmy_db_views_vote = { workspace = true }
|
||||
lemmy_db_views_local_user = { workspace = true }
|
||||
lemmy_db_views_person = { workspace = true }
|
||||
lemmy_db_views_custom_emoji = { workspace = true }
|
||||
lemmy_db_views_reports = { workspace = true }
|
||||
lemmy_db_views_private_message = { workspace = true }
|
||||
lemmy_db_views_local_image = { workspace = true }
|
||||
lemmy_db_views_inbox_combined = { workspace = true }
|
||||
lemmy_db_views_modlog_combined = { workspace = true }
|
||||
lemmy_db_views_person_content_combined = { workspace = true }
|
||||
lemmy_db_views_person_saved_combined = { workspace = true }
|
||||
lemmy_db_views_report_combined = { workspace = true }
|
||||
lemmy_db_views_search_combined = { workspace = true }
|
||||
lemmy_db_views_site = { workspace = true }
|
||||
lemmy_db_views_registration_applications = { workspace = true }
|
||||
lemmy_db_schema = { workspace = true }
|
||||
lemmy_utils = { workspace = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
|
|
|
@ -20,7 +20,10 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, CommunityView, LocalUserView, PostView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_email::notifications::{
|
||||
send_comment_reply_email,
|
||||
send_mention_email,
|
||||
|
|
|
@ -7,7 +7,8 @@ use lemmy_db_schema::newtypes::{
|
|||
PostId,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommentSortType, ListingType};
|
||||
use lemmy_db_views::structs::{CommentSlimView, CommentView, VoteView};
|
||||
use lemmy_db_views_comment::{CommentSlimView, CommentView};
|
||||
use lemmy_db_views_vote::VoteView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
use lemmy_db_schema::{
|
||||
newtypes::{CommunityId, LanguageId, PaginationCursor, PersonId, TagId},
|
||||
source::site::Site,
|
||||
CommunitySortType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommunityVisibility, ListingType};
|
||||
use lemmy_db_views::structs::{
|
||||
CommunityModeratorView,
|
||||
CommunitySortType,
|
||||
CommunityView,
|
||||
PendingFollow,
|
||||
PersonView,
|
||||
};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_community_follower::PendingFollow;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use lemmy_db_schema::newtypes::CustomEmojiId;
|
||||
use lemmy_db_views::structs::CustomEmojiView;
|
||||
use lemmy_db_views_custom_emoji::CustomEmojiView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -27,7 +27,6 @@ pub mod tags;
|
|||
pub mod utils;
|
||||
|
||||
pub extern crate lemmy_db_schema;
|
||||
pub extern crate lemmy_db_views;
|
||||
pub extern crate lemmy_utils;
|
||||
|
||||
pub use lemmy_utils::error::LemmyErrorType;
|
||||
|
|
|
@ -14,14 +14,12 @@ use lemmy_db_schema::{
|
|||
PersonContentType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommentSortType, ListingType, PostListingMode, PostSortType};
|
||||
use lemmy_db_views::structs::{
|
||||
CommunityModeratorView,
|
||||
InboxCombinedView,
|
||||
LocalImageView,
|
||||
PersonContentCombinedView,
|
||||
PersonSavedCombinedView,
|
||||
PersonView,
|
||||
};
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_inbox_combined::InboxCombinedView;
|
||||
use lemmy_db_views_local_image::LocalImageView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_db_views_person_content_combined::PersonContentCombinedView;
|
||||
use lemmy_db_views_person_saved_combined::PersonSavedCombinedView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -3,7 +3,9 @@ use lemmy_db_schema::{
|
|||
PostFeatureType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{ListingType, PostSortType};
|
||||
use lemmy_db_views::structs::{CommunityView, PostView, VoteView};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_vote::VoteView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId};
|
||||
use lemmy_db_views::structs::PrivateMessageView;
|
||||
use lemmy_db_views_private_message::PrivateMessageView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
|
|
@ -2,7 +2,7 @@ use lemmy_db_schema::{
|
|||
newtypes::{CommunityId, PaginationCursor, PostId},
|
||||
ReportType,
|
||||
};
|
||||
use lemmy_db_views::structs::ReportCombinedView;
|
||||
use lemmy_db_views_report_combined::ReportCombinedView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use lemmy_db_schema::newtypes::{CommentId, CommentReportId};
|
||||
use lemmy_db_views::structs::CommentReportView;
|
||||
use lemmy_db_views_reports::CommentReportView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use lemmy_db_schema::newtypes::{CommunityId, CommunityReportId};
|
||||
use lemmy_db_views::structs::CommunityReportView;
|
||||
use lemmy_db_views_reports::CommunityReportView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use lemmy_db_schema::newtypes::{PostId, PostReportId};
|
||||
use lemmy_db_views::structs::PostReportView;
|
||||
use lemmy_db_views_reports::PostReportView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use lemmy_db_schema::newtypes::{PrivateMessageId, PrivateMessageReportId};
|
||||
use lemmy_db_views::structs::PrivateMessageReportView;
|
||||
use lemmy_db_views_reports::PrivateMessageReportView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_db_schema::{
|
|||
private_message::PrivateMessage,
|
||||
},
|
||||
};
|
||||
use lemmy_db_views::structs::PrivateMessageView;
|
||||
use lemmy_db_views_private_message::PrivateMessageView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use std::sync::{LazyLock, OnceLock};
|
||||
use tokio::{
|
||||
|
|
|
@ -33,19 +33,17 @@ use lemmy_db_schema_file::enums::{
|
|||
PostSortType,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_views::structs::{
|
||||
CommentView,
|
||||
CommunityFollowerView,
|
||||
CommunityModeratorView,
|
||||
CommunityView,
|
||||
LocalUserView,
|
||||
ModlogCombinedView,
|
||||
PersonView,
|
||||
PostView,
|
||||
RegistrationApplicationView,
|
||||
SearchCombinedView,
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_community_follower::CommunityFollowerView;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_modlog_combined::ModlogCombinedView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_registration_applications::RegistrationApplicationView;
|
||||
use lemmy_db_views_search_combined::SearchCombinedView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use url::Url;
|
||||
|
|
|
@ -6,7 +6,8 @@ use lemmy_db_schema::{
|
|||
post_tag::{PostTag, PostTagForm},
|
||||
},
|
||||
};
|
||||
use lemmy_db_views::structs::{CommunityView, LocalUserView};
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
|
|
@ -39,16 +39,13 @@ use lemmy_db_schema::{
|
|||
utils::DbPool,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{FederationMode, RegistrationMode};
|
||||
use lemmy_db_views::structs::{
|
||||
CommunityFollowerView,
|
||||
CommunityModeratorView,
|
||||
CommunityPersonBanView,
|
||||
CommunityView,
|
||||
LocalImageView,
|
||||
LocalUserView,
|
||||
PersonView,
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_db_views_community_follower::CommunityFollowerView;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_community_person_ban::CommunityPersonBanView;
|
||||
use lemmy_db_views_local_image::LocalImageView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyError, LemmyErrorExt, LemmyErrorExt2, LemmyErrorType, LemmyResult},
|
||||
rate_limit::{ActionType, BucketConfig},
|
||||
|
@ -72,13 +69,50 @@ use webmention::{Webmention, WebmentionError};
|
|||
|
||||
pub const AUTH_COOKIE_NAME: &str = "jwt";
|
||||
|
||||
pub async fn check_is_mod_or_admin(
|
||||
pool: &mut DbPool<'_>,
|
||||
person_id: PersonId,
|
||||
community_id: CommunityId,
|
||||
local_instance_id: InstanceId,
|
||||
) -> LemmyResult<()> {
|
||||
let is_mod =
|
||||
CommunityModeratorView::check_is_community_moderator(pool, community_id, person_id).await;
|
||||
if is_mod.is_ok()
|
||||
|| PersonView::read(pool, person_id, local_instance_id, false)
|
||||
.await
|
||||
.is_ok_and(|t| t.is_admin)
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
Err(LemmyErrorType::NotAModOrAdmin)?
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if a person is an admin, or moderator of any community.
|
||||
pub(crate) async fn check_is_mod_of_any_or_admin(
|
||||
pool: &mut DbPool<'_>,
|
||||
person_id: PersonId,
|
||||
local_instance_id: InstanceId,
|
||||
) -> LemmyResult<()> {
|
||||
let is_mod_of_any = CommunityModeratorView::is_community_moderator_of_any(pool, person_id).await;
|
||||
if is_mod_of_any.is_ok()
|
||||
|| PersonView::read(pool, person_id, local_instance_id, false)
|
||||
.await
|
||||
.is_ok_and(|t| t.is_admin)
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
Err(LemmyErrorType::NotAModOrAdmin)?
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn is_mod_or_admin(
|
||||
pool: &mut DbPool<'_>,
|
||||
local_user_view: &LocalUserView,
|
||||
community_id: CommunityId,
|
||||
) -> LemmyResult<()> {
|
||||
check_local_user_valid(local_user_view)?;
|
||||
CommunityView::check_is_mod_or_admin(
|
||||
check_is_mod_or_admin(
|
||||
pool,
|
||||
local_user_view.person.id,
|
||||
community_id,
|
||||
|
@ -113,7 +147,7 @@ pub async fn check_community_mod_of_any_or_admin_action(
|
|||
let person = &local_user_view.person;
|
||||
|
||||
check_local_user_valid(local_user_view)?;
|
||||
CommunityView::check_is_mod_of_any_or_admin(pool, person.id, person.instance_id).await
|
||||
check_is_mod_of_any_or_admin(pool, person.id, person.instance_id).await
|
||||
}
|
||||
|
||||
pub fn is_admin(local_user_view: &LocalUserView) -> LemmyResult<()> {
|
||||
|
@ -949,7 +983,6 @@ pub fn send_webmention(post: Post, community: &Community) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
|
@ -960,9 +993,11 @@ mod tests {
|
|||
},
|
||||
ModlogActionType,
|
||||
};
|
||||
use lemmy_db_views::{
|
||||
combined::modlog_combined_view::ModlogCombinedQuery,
|
||||
structs::{ModRemoveCommentView, ModRemovePostView, ModlogCombinedView},
|
||||
use lemmy_db_views_modlog_combined::{
|
||||
impls::ModlogCombinedQuery,
|
||||
ModRemoveCommentView,
|
||||
ModRemovePostView,
|
||||
ModlogCombinedView,
|
||||
};
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
|
|
|
@ -13,9 +13,19 @@ repository.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_comment = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_moderator = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_follower = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_post = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_local_user = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_person = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_custom_emoji = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_private_message = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_search_combined = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_site = { workspace = true, features = ["full"] }
|
||||
lemmy_utils = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_email = { workspace = true }
|
||||
|
|
|
@ -27,7 +27,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::{Crud, Likeable},
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, PostView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
utils::{mention::scrape_text_for_mentions, validation::is_valid_body_field},
|
||||
|
|
|
@ -12,7 +12,8 @@ use lemmy_db_schema::{
|
|||
source::comment::{Comment, CommentUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views::structs::{CommentView, LocalUserView};
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn delete_comment(
|
||||
|
|
|
@ -5,7 +5,8 @@ use lemmy_api_common::{
|
|||
context::LemmyContext,
|
||||
utils::check_private_instance,
|
||||
};
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_comment(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue