Merge remote-tracking branch 'origin/split-db-workspace2' into move_views_to_diesel_split_2
This commit is contained in:
commit
4c681eb48b
117 changed files with 416 additions and 360 deletions
|
@ -17,7 +17,7 @@ steps:
|
||||||
- name: cargo clippy
|
- name: cargo clippy
|
||||||
image: ekidd/rust-musl-builder:1.47.0
|
image: ekidd/rust-musl-builder:1.47.0
|
||||||
commands:
|
commands:
|
||||||
- cargo clippy --all-targets --all-features -- -D warnings
|
- cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
- name: check documentation build
|
- name: check documentation build
|
||||||
image: ekidd/rust-musl-builder:1.47.0
|
image: ekidd/rust-musl-builder:1.47.0
|
||||||
|
|
63
Cargo.lock
generated
63
Cargo.lock
generated
|
@ -1717,9 +1717,11 @@ dependencies = [
|
||||||
"jsonwebtoken",
|
"jsonwebtoken",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lemmy_apub",
|
"lemmy_apub",
|
||||||
"lemmy_db",
|
"lemmy_db_queries",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
"lemmy_rate_limit",
|
"lemmy_db_views",
|
||||||
|
"lemmy_db_views_actor",
|
||||||
|
"lemmy_db_views_moderator",
|
||||||
"lemmy_structs",
|
"lemmy_structs",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"lemmy_websocket",
|
"lemmy_websocket",
|
||||||
|
@ -1762,8 +1764,10 @@ dependencies = [
|
||||||
"http-signature-normalization-reqwest",
|
"http-signature-normalization-reqwest",
|
||||||
"itertools",
|
"itertools",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lemmy_db",
|
"lemmy_db_queries",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
|
"lemmy_db_views",
|
||||||
|
"lemmy_db_views_actor",
|
||||||
"lemmy_structs",
|
"lemmy_structs",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"lemmy_websocket",
|
"lemmy_websocket",
|
||||||
|
@ -1784,7 +1788,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_db"
|
name = "lemmy_db_queries"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bcrypt",
|
"bcrypt",
|
||||||
|
@ -1817,16 +1821,33 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_rate_limit"
|
name = "lemmy_db_views"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"diesel",
|
||||||
"futures",
|
"lemmy_db_queries",
|
||||||
"lemmy_utils",
|
"lemmy_db_schema",
|
||||||
"log",
|
"serde 1.0.118",
|
||||||
"strum",
|
]
|
||||||
"strum_macros",
|
|
||||||
"tokio 0.3.6",
|
[[package]]
|
||||||
|
name = "lemmy_db_views_actor"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"diesel",
|
||||||
|
"lemmy_db_queries",
|
||||||
|
"lemmy_db_schema",
|
||||||
|
"serde 1.0.118",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lemmy_db_views_moderator"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"diesel",
|
||||||
|
"lemmy_db_queries",
|
||||||
|
"lemmy_db_schema",
|
||||||
|
"serde 1.0.118",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1850,9 +1871,11 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lemmy_api",
|
"lemmy_api",
|
||||||
"lemmy_apub",
|
"lemmy_apub",
|
||||||
"lemmy_db",
|
"lemmy_db_queries",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
"lemmy_rate_limit",
|
"lemmy_db_views",
|
||||||
|
"lemmy_db_views_actor",
|
||||||
|
"lemmy_db_views_moderator",
|
||||||
"lemmy_structs",
|
"lemmy_structs",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"lemmy_websocket",
|
"lemmy_websocket",
|
||||||
|
@ -1875,8 +1898,11 @@ dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"chrono",
|
"chrono",
|
||||||
"diesel",
|
"diesel",
|
||||||
"lemmy_db",
|
"lemmy_db_queries",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
|
"lemmy_db_views",
|
||||||
|
"lemmy_db_views_actor",
|
||||||
|
"lemmy_db_views_moderator",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"log",
|
"log",
|
||||||
"serde 1.0.118",
|
"serde 1.0.118",
|
||||||
|
@ -1893,6 +1919,7 @@ dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"comrak",
|
"comrak",
|
||||||
"config",
|
"config",
|
||||||
|
"futures",
|
||||||
"itertools",
|
"itertools",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lettre",
|
"lettre",
|
||||||
|
@ -1904,7 +1931,10 @@ dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde 1.0.118",
|
"serde 1.0.118",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"strum",
|
||||||
|
"strum_macros",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"tokio 0.3.6",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1917,9 +1947,8 @@ dependencies = [
|
||||||
"background-jobs",
|
"background-jobs",
|
||||||
"chrono",
|
"chrono",
|
||||||
"diesel",
|
"diesel",
|
||||||
"lemmy_db",
|
"lemmy_db_queries",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
"lemmy_rate_limit",
|
|
||||||
"lemmy_structs",
|
"lemmy_structs",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"log",
|
"log",
|
||||||
|
|
12
Cargo.toml
12
Cargo.toml
|
@ -11,10 +11,12 @@ members = [
|
||||||
"lemmy_api",
|
"lemmy_api",
|
||||||
"lemmy_apub",
|
"lemmy_apub",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"lemmy_db",
|
"lemmy_db_queries",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
|
"lemmy_db_views",
|
||||||
|
"lemmy_db_views_actor",
|
||||||
|
"lemmy_db_views_actor",
|
||||||
"lemmy_structs",
|
"lemmy_structs",
|
||||||
"lemmy_rate_limit",
|
|
||||||
"lemmy_websocket",
|
"lemmy_websocket",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -23,9 +25,11 @@ lemmy_api = { path = "./lemmy_api" }
|
||||||
lemmy_apub = { path = "./lemmy_apub" }
|
lemmy_apub = { path = "./lemmy_apub" }
|
||||||
lemmy_utils = { path = "./lemmy_utils" }
|
lemmy_utils = { path = "./lemmy_utils" }
|
||||||
lemmy_db_schema = { path = "./lemmy_db_schema" }
|
lemmy_db_schema = { path = "./lemmy_db_schema" }
|
||||||
lemmy_db = { path = "./lemmy_db" }
|
lemmy_db_queries = { path = "lemmy_db_queries" }
|
||||||
|
lemmy_db_views = { path = "./lemmy_db_views" }
|
||||||
|
lemmy_db_views_moderator = { path = "./lemmy_db_views_moderator" }
|
||||||
|
lemmy_db_views_actor = { path = "lemmy_db_views_actor" }
|
||||||
lemmy_structs = { path = "./lemmy_structs" }
|
lemmy_structs = { path = "./lemmy_structs" }
|
||||||
lemmy_rate_limit = { path = "./lemmy_rate_limit" }
|
|
||||||
lemmy_websocket = { path = "./lemmy_websocket" }
|
lemmy_websocket = { path = "./lemmy_websocket" }
|
||||||
diesel = "1.4.5"
|
diesel = "1.4.5"
|
||||||
diesel_migrations = "1.4.0"
|
diesel_migrations = "1.4.0"
|
||||||
|
|
|
@ -11,10 +11,12 @@ path = "src/lib.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_apub = { path = "../lemmy_apub" }
|
lemmy_apub = { path = "../lemmy_apub" }
|
||||||
lemmy_utils = { path = "../lemmy_utils" }
|
lemmy_utils = { path = "../lemmy_utils" }
|
||||||
lemmy_db = { path = "../lemmy_db" }
|
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||||
|
lemmy_db_views = { path = "../lemmy_db_views" }
|
||||||
|
lemmy_db_views_moderator = { path = "../lemmy_db_views_moderator" }
|
||||||
|
lemmy_db_views_actor = { path = "../lemmy_db_views_actor" }
|
||||||
lemmy_structs = { path = "../lemmy_structs" }
|
lemmy_structs = { path = "../lemmy_structs" }
|
||||||
lemmy_rate_limit = { path = "../lemmy_rate_limit" }
|
|
||||||
lemmy_websocket = { path = "../lemmy_websocket" }
|
lemmy_websocket = { path = "../lemmy_websocket" }
|
||||||
diesel = "1.4.5"
|
diesel = "1.4.5"
|
||||||
bcrypt = "0.9.0"
|
bcrypt = "0.9.0"
|
||||||
|
|
|
@ -10,12 +10,8 @@ use crate::{
|
||||||
};
|
};
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_apub::{ApubLikeableType, ApubObjectType};
|
use lemmy_apub::{ApubLikeableType, ApubObjectType};
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{
|
||||||
source::comment::Comment_,
|
source::comment::Comment_,
|
||||||
views::{
|
|
||||||
comment_report_view::{CommentReportQueryBuilder, CommentReportView},
|
|
||||||
comment_view::{CommentQueryBuilder, CommentView},
|
|
||||||
},
|
|
||||||
Crud,
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
ListingType,
|
ListingType,
|
||||||
|
@ -24,6 +20,10 @@ use lemmy_db::{
|
||||||
SortType,
|
SortType,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::source::{comment::*, comment_report::*, moderator::*};
|
use lemmy_db_schema::source::{comment::*, comment_report::*, moderator::*};
|
||||||
|
use lemmy_db_views::{
|
||||||
|
comment_report_view::{CommentReportQueryBuilder, CommentReportView},
|
||||||
|
comment_view::{CommentQueryBuilder, CommentView},
|
||||||
|
};
|
||||||
use lemmy_structs::{blocking, comment::*, send_local_notifs};
|
use lemmy_structs::{blocking, comment::*, send_local_notifs};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
apub::{make_apub_endpoint, EndpointType},
|
apub::{make_apub_endpoint, EndpointType},
|
||||||
|
|
|
@ -9,22 +9,13 @@ use crate::{
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_apub::ActorType;
|
use lemmy_apub::ActorType;
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{
|
||||||
diesel_option_overwrite,
|
diesel_option_overwrite,
|
||||||
source::{
|
source::{
|
||||||
comment::Comment_,
|
comment::Comment_,
|
||||||
community::{CommunityModerator_, Community_},
|
community::{CommunityModerator_, Community_},
|
||||||
post::Post_,
|
post::Post_,
|
||||||
},
|
},
|
||||||
views::{
|
|
||||||
comment_view::CommentQueryBuilder,
|
|
||||||
community::{
|
|
||||||
community_follower_view::CommunityFollowerView,
|
|
||||||
community_moderator_view::CommunityModeratorView,
|
|
||||||
community_view::{CommunityQueryBuilder, CommunityView},
|
|
||||||
},
|
|
||||||
user_view::UserViewSafe,
|
|
||||||
},
|
|
||||||
ApubObject,
|
ApubObject,
|
||||||
Bannable,
|
Bannable,
|
||||||
Crud,
|
Crud,
|
||||||
|
@ -36,6 +27,13 @@ use lemmy_db_schema::{
|
||||||
naive_now,
|
naive_now,
|
||||||
source::{comment::Comment, community::*, moderator::*, post::Post, site::*},
|
source::{comment::Comment, community::*, moderator::*, post::Post, site::*},
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::comment_view::CommentQueryBuilder;
|
||||||
|
use lemmy_db_views_actor::{
|
||||||
|
community_follower_view::CommunityFollowerView,
|
||||||
|
community_moderator_view::CommunityModeratorView,
|
||||||
|
community_view::{CommunityQueryBuilder, CommunityView},
|
||||||
|
user_view::UserViewSafe,
|
||||||
|
};
|
||||||
use lemmy_structs::{blocking, community::*};
|
use lemmy_structs::{blocking, community::*};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
apub::{generate_actor_keypair, make_apub_endpoint, EndpointType},
|
apub::{generate_actor_keypair, make_apub_endpoint, EndpointType},
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
use crate::claims::Claims;
|
use crate::claims::Claims;
|
||||||
use actix_web::{web, web::Data};
|
use actix_web::{web, web::Data};
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{
|
||||||
source::{
|
source::{
|
||||||
community::{CommunityModerator_, Community_},
|
community::{CommunityModerator_, Community_},
|
||||||
site::Site_,
|
site::Site_,
|
||||||
},
|
},
|
||||||
views::community::community_user_ban_view::CommunityUserBanView,
|
|
||||||
Crud,
|
Crud,
|
||||||
DbPool,
|
DbPool,
|
||||||
};
|
};
|
||||||
|
@ -15,6 +14,10 @@ use lemmy_db_schema::source::{
|
||||||
site::Site,
|
site::Site,
|
||||||
user::User_,
|
user::User_,
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views_actor::{
|
||||||
|
community_user_ban_view::CommunityUserBanView,
|
||||||
|
community_view::CommunityView,
|
||||||
|
};
|
||||||
use lemmy_structs::{blocking, comment::*, community::*, post::*, site::*, user::*};
|
use lemmy_structs::{blocking, comment::*, community::*, post::*, site::*, user::*};
|
||||||
use lemmy_utils::{settings::Settings, APIError, ConnectionId, LemmyError};
|
use lemmy_utils::{settings::Settings, APIError, ConnectionId, LemmyError};
|
||||||
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
|
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
|
||||||
|
@ -47,7 +50,7 @@ pub(crate) async fn is_mod_or_admin(
|
||||||
community_id: i32,
|
community_id: i32,
|
||||||
) -> Result<(), LemmyError> {
|
) -> Result<(), LemmyError> {
|
||||||
let is_mod_or_admin = blocking(pool, move |conn| {
|
let is_mod_or_admin = blocking(pool, move |conn| {
|
||||||
Community::is_mod_or_admin(conn, user_id, community_id)
|
CommunityView::is_mod_or_admin(conn, user_id, community_id)
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
if !is_mod_or_admin {
|
if !is_mod_or_admin {
|
||||||
|
|
|
@ -10,14 +10,8 @@ use crate::{
|
||||||
};
|
};
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use lemmy_apub::{ApubLikeableType, ApubObjectType};
|
use lemmy_apub::{ApubLikeableType, ApubObjectType};
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{
|
||||||
source::post::Post_,
|
source::post::Post_,
|
||||||
views::{
|
|
||||||
comment_view::CommentQueryBuilder,
|
|
||||||
community::{community_moderator_view::CommunityModeratorView, community_view::CommunityView},
|
|
||||||
post_report_view::{PostReportQueryBuilder, PostReportView},
|
|
||||||
post_view::{PostQueryBuilder, PostView},
|
|
||||||
},
|
|
||||||
Crud,
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
ListingType,
|
ListingType,
|
||||||
|
@ -33,6 +27,15 @@ use lemmy_db_schema::{
|
||||||
post_report::{PostReport, PostReportForm},
|
post_report::{PostReport, PostReportForm},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::{
|
||||||
|
comment_view::CommentQueryBuilder,
|
||||||
|
post_report_view::{PostReportQueryBuilder, PostReportView},
|
||||||
|
post_view::{PostQueryBuilder, PostView},
|
||||||
|
};
|
||||||
|
use lemmy_db_views_actor::{
|
||||||
|
community_moderator_view::CommunityModeratorView,
|
||||||
|
community_view::CommunityView,
|
||||||
|
};
|
||||||
use lemmy_structs::{blocking, post::*};
|
use lemmy_structs::{blocking, post::*};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
apub::{make_apub_endpoint, EndpointType},
|
apub::{make_apub_endpoint, EndpointType},
|
||||||
|
|
|
@ -9,27 +9,9 @@ use crate::{
|
||||||
use actix_web::web::Data;
|
use actix_web::web::Data;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_apub::fetcher::search_by_apub_id;
|
use lemmy_apub::fetcher::search_by_apub_id;
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{
|
||||||
diesel_option_overwrite,
|
diesel_option_overwrite,
|
||||||
source::{category::Category_, site::Site_},
|
source::{category::Category_, site::Site_},
|
||||||
views::{
|
|
||||||
comment_view::CommentQueryBuilder,
|
|
||||||
community::community_view::CommunityQueryBuilder,
|
|
||||||
moderator::{
|
|
||||||
mod_add_community_view::ModAddCommunityView,
|
|
||||||
mod_add_view::ModAddView,
|
|
||||||
mod_ban_from_community_view::ModBanFromCommunityView,
|
|
||||||
mod_ban_view::ModBanView,
|
|
||||||
mod_lock_post_view::ModLockPostView,
|
|
||||||
mod_remove_comment_view::ModRemoveCommentView,
|
|
||||||
mod_remove_community_view::ModRemoveCommunityView,
|
|
||||||
mod_remove_post_view::ModRemovePostView,
|
|
||||||
mod_sticky_post_view::ModStickyPostView,
|
|
||||||
},
|
|
||||||
post_view::PostQueryBuilder,
|
|
||||||
site_view::SiteView,
|
|
||||||
user_view::{UserQueryBuilder, UserViewSafe},
|
|
||||||
},
|
|
||||||
Crud,
|
Crud,
|
||||||
SearchType,
|
SearchType,
|
||||||
SortType,
|
SortType,
|
||||||
|
@ -42,6 +24,26 @@ use lemmy_db_schema::{
|
||||||
site::{Site, *},
|
site::{Site, *},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::{
|
||||||
|
comment_view::CommentQueryBuilder,
|
||||||
|
post_view::PostQueryBuilder,
|
||||||
|
site_view::SiteView,
|
||||||
|
};
|
||||||
|
use lemmy_db_views_actor::{
|
||||||
|
community_view::CommunityQueryBuilder,
|
||||||
|
user_view::{UserQueryBuilder, UserViewSafe},
|
||||||
|
};
|
||||||
|
use lemmy_db_views_moderator::{
|
||||||
|
mod_add_community_view::ModAddCommunityView,
|
||||||
|
mod_add_view::ModAddView,
|
||||||
|
mod_ban_from_community_view::ModBanFromCommunityView,
|
||||||
|
mod_ban_view::ModBanView,
|
||||||
|
mod_lock_post_view::ModLockPostView,
|
||||||
|
mod_remove_comment_view::ModRemoveCommentView,
|
||||||
|
mod_remove_community_view::ModRemoveCommunityView,
|
||||||
|
mod_remove_post_view::ModRemovePostView,
|
||||||
|
mod_sticky_post_view::ModStickyPostView,
|
||||||
|
};
|
||||||
use lemmy_structs::{blocking, site::*, user::Register};
|
use lemmy_structs::{blocking, site::*, user::Register};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
location_info,
|
location_info,
|
||||||
|
|
|
@ -14,7 +14,7 @@ use bcrypt::verify;
|
||||||
use captcha::{gen, Difficulty};
|
use captcha::{gen, Difficulty};
|
||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
use lemmy_apub::ApubObjectType;
|
use lemmy_apub::ApubObjectType;
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{
|
||||||
diesel_option_overwrite,
|
diesel_option_overwrite,
|
||||||
source::{
|
source::{
|
||||||
comment::Comment_,
|
comment::Comment_,
|
||||||
|
@ -26,19 +26,6 @@ use lemmy_db::{
|
||||||
user::User,
|
user::User,
|
||||||
user_mention::UserMention_,
|
user_mention::UserMention_,
|
||||||
},
|
},
|
||||||
views::{
|
|
||||||
comment_report_view::CommentReportView,
|
|
||||||
comment_view::CommentQueryBuilder,
|
|
||||||
community::{
|
|
||||||
community_follower_view::CommunityFollowerView,
|
|
||||||
community_moderator_view::CommunityModeratorView,
|
|
||||||
},
|
|
||||||
post_report_view::PostReportView,
|
|
||||||
post_view::PostQueryBuilder,
|
|
||||||
private_message_view::{PrivateMessageQueryBuilder, PrivateMessageView},
|
|
||||||
user_mention_view::{UserMentionQueryBuilder, UserMentionView},
|
|
||||||
user_view::{UserViewDangerous, UserViewSafe},
|
|
||||||
},
|
|
||||||
Crud,
|
Crud,
|
||||||
Followable,
|
Followable,
|
||||||
Joinable,
|
Joinable,
|
||||||
|
@ -59,6 +46,19 @@ use lemmy_db_schema::{
|
||||||
user_mention::*,
|
user_mention::*,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::{
|
||||||
|
comment_report_view::CommentReportView,
|
||||||
|
comment_view::CommentQueryBuilder,
|
||||||
|
post_report_view::PostReportView,
|
||||||
|
post_view::PostQueryBuilder,
|
||||||
|
private_message_view::{PrivateMessageQueryBuilder, PrivateMessageView},
|
||||||
|
};
|
||||||
|
use lemmy_db_views_actor::{
|
||||||
|
community_follower_view::CommunityFollowerView,
|
||||||
|
community_moderator_view::CommunityModeratorView,
|
||||||
|
user_mention_view::{UserMentionQueryBuilder, UserMentionView},
|
||||||
|
user_view::{UserViewDangerous, UserViewSafe},
|
||||||
|
};
|
||||||
use lemmy_structs::{blocking, send_email_to_user, user::*};
|
use lemmy_structs::{blocking, send_email_to_user, user::*};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
apub::{generate_actor_keypair, make_apub_endpoint, EndpointType},
|
apub::{generate_actor_keypair, make_apub_endpoint, EndpointType},
|
||||||
|
|
|
@ -10,8 +10,10 @@ path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_utils = { path = "../lemmy_utils" }
|
lemmy_utils = { path = "../lemmy_utils" }
|
||||||
lemmy_db = { path = "../lemmy_db" }
|
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||||
|
lemmy_db_views = { path = "../lemmy_db_views" }
|
||||||
|
lemmy_db_views_actor = { path = "../lemmy_db_views_actor" }
|
||||||
lemmy_structs = { path = "../lemmy_structs" }
|
lemmy_structs = { path = "../lemmy_structs" }
|
||||||
lemmy_websocket = { path = "../lemmy_websocket" }
|
lemmy_websocket = { path = "../lemmy_websocket" }
|
||||||
diesel = "1.4.5"
|
diesel = "1.4.5"
|
||||||
|
|
|
@ -4,11 +4,12 @@ use activitystreams::{
|
||||||
base::ExtendsExt,
|
base::ExtendsExt,
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{source::comment::Comment_, views::comment_view::CommentView, Crud, Likeable};
|
use lemmy_db_queries::{source::comment::Comment_, Crud, Likeable};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
comment::{Comment, CommentLike, CommentLikeForm},
|
comment::{Comment, CommentLike, CommentLikeForm},
|
||||||
post::Post,
|
post::Post,
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::comment_view::CommentView;
|
||||||
use lemmy_structs::{blocking, comment::CommentResponse, send_local_notifs};
|
use lemmy_structs::{blocking, comment::CommentResponse, send_local_notifs};
|
||||||
use lemmy_utils::{location_info, utils::scrape_text_for_mentions, LemmyError};
|
use lemmy_utils::{location_info, utils::scrape_text_for_mentions, LemmyError};
|
||||||
use lemmy_websocket::{messages::SendComment, LemmyContext, UserOperation};
|
use lemmy_websocket::{messages::SendComment, LemmyContext, UserOperation};
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::activities::receive::get_actor_as_user;
|
use crate::activities::receive::get_actor_as_user;
|
||||||
use activitystreams::activity::{Dislike, Like};
|
use activitystreams::activity::{Dislike, Like};
|
||||||
use lemmy_db::{source::comment::Comment_, views::comment_view::CommentView, Likeable};
|
use lemmy_db_queries::{source::comment::Comment_, Likeable};
|
||||||
use lemmy_db_schema::source::comment::{Comment, CommentLike};
|
use lemmy_db_schema::source::comment::{Comment, CommentLike};
|
||||||
|
use lemmy_db_views::comment_view::CommentView;
|
||||||
use lemmy_structs::{blocking, comment::CommentResponse};
|
use lemmy_structs::{blocking, comment::CommentResponse};
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use lemmy_websocket::{messages::SendComment, LemmyContext, UserOperation};
|
use lemmy_websocket::{messages::SendComment, LemmyContext, UserOperation};
|
||||||
|
|
|
@ -4,12 +4,9 @@ use activitystreams::{
|
||||||
base::{AnyBase, ExtendsExt},
|
base::{AnyBase, ExtendsExt},
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{source::community::Community_, ApubObject};
|
||||||
source::community::Community_,
|
|
||||||
views::community::community_view::CommunityView,
|
|
||||||
ApubObject,
|
|
||||||
};
|
|
||||||
use lemmy_db_schema::source::community::Community;
|
use lemmy_db_schema::source::community::Community;
|
||||||
|
use lemmy_db_views_actor::community_view::CommunityView;
|
||||||
use lemmy_structs::{blocking, community::CommunityResponse};
|
use lemmy_structs::{blocking, community::CommunityResponse};
|
||||||
use lemmy_utils::{location_info, LemmyError};
|
use lemmy_utils::{location_info, LemmyError};
|
||||||
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
|
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
|
||||||
|
|
|
@ -4,8 +4,9 @@ use activitystreams::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{source::post::Post_, views::post_view::PostView, Likeable};
|
use lemmy_db_queries::{source::post::Post_, Likeable};
|
||||||
use lemmy_db_schema::source::post::{Post, PostLike, PostLikeForm};
|
use lemmy_db_schema::source::post::{Post, PostLike, PostLikeForm};
|
||||||
|
use lemmy_db_views::post_view::PostView;
|
||||||
use lemmy_structs::{blocking, post::PostResponse};
|
use lemmy_structs::{blocking, post::PostResponse};
|
||||||
use lemmy_utils::{location_info, LemmyError};
|
use lemmy_utils::{location_info, LemmyError};
|
||||||
use lemmy_websocket::{messages::SendPost, LemmyContext, UserOperation};
|
use lemmy_websocket::{messages::SendPost, LemmyContext, UserOperation};
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::activities::receive::get_actor_as_user;
|
use crate::activities::receive::get_actor_as_user;
|
||||||
use activitystreams::activity::{Dislike, Like};
|
use activitystreams::activity::{Dislike, Like};
|
||||||
use lemmy_db::{source::post::Post_, views::post_view::PostView, Likeable};
|
use lemmy_db_queries::{source::post::Post_, Likeable};
|
||||||
use lemmy_db_schema::source::post::{Post, PostLike};
|
use lemmy_db_schema::source::post::{Post, PostLike};
|
||||||
|
use lemmy_db_views::post_view::PostView;
|
||||||
use lemmy_structs::{blocking, post::PostResponse};
|
use lemmy_structs::{blocking, post::PostResponse};
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use lemmy_websocket::{messages::SendPost, LemmyContext, UserOperation};
|
use lemmy_websocket::{messages::SendPost, LemmyContext, UserOperation};
|
||||||
|
|
|
@ -13,11 +13,9 @@ use activitystreams::{
|
||||||
public,
|
public,
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::source::private_message::PrivateMessage_;
|
||||||
source::private_message::PrivateMessage_,
|
|
||||||
views::private_message_view::PrivateMessageView,
|
|
||||||
};
|
|
||||||
use lemmy_db_schema::source::private_message::PrivateMessage;
|
use lemmy_db_schema::source::private_message::PrivateMessage;
|
||||||
|
use lemmy_db_views::private_message_view::PrivateMessageView;
|
||||||
use lemmy_structs::{blocking, user::PrivateMessageResponse};
|
use lemmy_structs::{blocking, user::PrivateMessageResponse};
|
||||||
use lemmy_utils::{location_info, LemmyError};
|
use lemmy_utils::{location_info, LemmyError};
|
||||||
use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperation};
|
use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperation};
|
||||||
|
|
|
@ -26,7 +26,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lemmy_db::{Crud, DbPool};
|
use lemmy_db_queries::{Crud, DbPool};
|
||||||
use lemmy_db_schema::source::{comment::Comment, community::Community, post::Post, user::User_};
|
use lemmy_db_schema::source::{comment::Comment, community::Community, post::Post, user::User_};
|
||||||
use lemmy_structs::{blocking, WebFingerResponse};
|
use lemmy_structs::{blocking, WebFingerResponse};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
|
|
|
@ -23,8 +23,9 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lemmy_db::{views::community::community_follower_view::CommunityFollowerView, DbPool};
|
use lemmy_db_queries::DbPool;
|
||||||
use lemmy_db_schema::source::community::Community;
|
use lemmy_db_schema::source::community::Community;
|
||||||
|
use lemmy_db_views_actor::community_follower_view::CommunityFollowerView;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
|
|
@ -21,7 +21,7 @@ use activitystreams::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
public,
|
public,
|
||||||
};
|
};
|
||||||
use lemmy_db::Crud;
|
use lemmy_db_queries::Crud;
|
||||||
use lemmy_db_schema::source::{community::Community, post::Post, user::User_};
|
use lemmy_db_schema::source::{community::Community, post::Post, user::User_};
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
|
|
|
@ -16,7 +16,7 @@ use activitystreams::{
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use lemmy_db::Crud;
|
use lemmy_db_queries::Crud;
|
||||||
use lemmy_db_schema::source::{private_message::PrivateMessage, user::User_};
|
use lemmy_db_schema::source::{private_message::PrivateMessage, user::User_};
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
|
|
|
@ -13,7 +13,7 @@ use activitystreams::{
|
||||||
base::{AnyBase, BaseExt, ExtendsExt},
|
base::{AnyBase, BaseExt, ExtendsExt},
|
||||||
object::ObjectExt,
|
object::ObjectExt,
|
||||||
};
|
};
|
||||||
use lemmy_db::{ApubObject, DbPool, Followable};
|
use lemmy_db_queries::{ApubObject, DbPool, Followable};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
community::{Community, CommunityFollower, CommunityFollowerForm},
|
community::{Community, CommunityFollower, CommunityFollowerForm},
|
||||||
user::User_,
|
user::User_,
|
||||||
|
|
|
@ -19,7 +19,7 @@ use background_jobs::{
|
||||||
WorkerConfig,
|
WorkerConfig,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lemmy_db::DbPool;
|
use lemmy_db_queries::DbPool;
|
||||||
use lemmy_db_schema::source::{community::Community, user::User_};
|
use lemmy_db_schema::source::{community::Community, user::User_};
|
||||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use activitystreams::unparsed::UnparsedMutExt;
|
use activitystreams::unparsed::UnparsedMutExt;
|
||||||
use activitystreams_ext::UnparsedExtension;
|
use activitystreams_ext::UnparsedExtension;
|
||||||
use diesel::PgConnection;
|
use diesel::PgConnection;
|
||||||
use lemmy_db::Crud;
|
use lemmy_db_queries::Crud;
|
||||||
use lemmy_db_schema::source::category::Category;
|
use lemmy_db_schema::source::category::Category;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -12,19 +12,7 @@ use activitystreams::{base::BaseExt, collection::OrderedCollection, prelude::*};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use diesel::result::Error::NotFound;
|
use diesel::result::Error::NotFound;
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{source::user::User, ApubObject, Crud, Joinable, SearchType};
|
||||||
source::user::User,
|
|
||||||
views::{
|
|
||||||
comment_view::CommentView,
|
|
||||||
community::community_view::CommunityView,
|
|
||||||
post_view::PostView,
|
|
||||||
user_view::UserViewSafe,
|
|
||||||
},
|
|
||||||
ApubObject,
|
|
||||||
Crud,
|
|
||||||
Joinable,
|
|
||||||
SearchType,
|
|
||||||
};
|
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
naive_now,
|
naive_now,
|
||||||
source::{
|
source::{
|
||||||
|
@ -34,6 +22,8 @@ use lemmy_db_schema::{
|
||||||
user::User_,
|
user::User_,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::{comment_view::CommentView, post_view::PostView};
|
||||||
|
use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
|
||||||
use lemmy_structs::{blocking, site::SearchResponse};
|
use lemmy_structs::{blocking, site::SearchResponse};
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
location_info,
|
location_info,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use actix_web::{body::Body, web, web::Path, HttpResponse};
|
use actix_web::{body::Body, web, web::Path, HttpResponse};
|
||||||
use diesel::result::Error::NotFound;
|
use diesel::result::Error::NotFound;
|
||||||
use lemmy_db::Crud;
|
use lemmy_db_queries::Crud;
|
||||||
use lemmy_db_schema::source::comment::Comment;
|
use lemmy_db_schema::source::comment::Comment;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
|
|
|
@ -9,11 +9,9 @@ use activitystreams::{
|
||||||
collection::{CollectionExt, OrderedCollection, UnorderedCollection},
|
collection::{CollectionExt, OrderedCollection, UnorderedCollection},
|
||||||
};
|
};
|
||||||
use actix_web::{body::Body, web, HttpResponse};
|
use actix_web::{body::Body, web, HttpResponse};
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::source::{community::Community_, post::Post_};
|
||||||
source::{community::Community_, post::Post_},
|
|
||||||
views::community::community_follower_view::CommunityFollowerView,
|
|
||||||
};
|
|
||||||
use lemmy_db_schema::source::{community::Community, post::Post};
|
use lemmy_db_schema::source::{community::Community, post::Post};
|
||||||
|
use lemmy_db_views_actor::community_follower_view::CommunityFollowerView;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::APUB_JSON_CONTENT_TYPE;
|
use crate::APUB_JSON_CONTENT_TYPE;
|
||||||
use actix_web::{body::Body, web, HttpResponse};
|
use actix_web::{body::Body, web, HttpResponse};
|
||||||
use lemmy_db::source::activity::Activity_;
|
use lemmy_db_queries::source::activity::Activity_;
|
||||||
use lemmy_db_schema::source::activity::Activity;
|
use lemmy_db_schema::source::activity::Activity;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{settings::Settings, LemmyError};
|
use lemmy_utils::{settings::Settings, LemmyError};
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use actix_web::{body::Body, web, HttpResponse};
|
use actix_web::{body::Body, web, HttpResponse};
|
||||||
use diesel::result::Error::NotFound;
|
use diesel::result::Error::NotFound;
|
||||||
use lemmy_db::Crud;
|
use lemmy_db_queries::Crud;
|
||||||
use lemmy_db_schema::source::post::Post;
|
use lemmy_db_schema::source::post::Post;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use activitystreams::{
|
||||||
collection::{CollectionExt, OrderedCollection},
|
collection::{CollectionExt, OrderedCollection},
|
||||||
};
|
};
|
||||||
use actix_web::{body::Body, web, HttpResponse};
|
use actix_web::{body::Body, web, HttpResponse};
|
||||||
use lemmy_db::source::user::User;
|
use lemmy_db_queries::source::user::User;
|
||||||
use lemmy_db_schema::source::user::User_;
|
use lemmy_db_schema::source::user::User_;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
|
|
|
@ -26,17 +26,12 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use actix_web::{web, HttpRequest, HttpResponse};
|
use actix_web::{web, HttpRequest, HttpResponse};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use lemmy_db::{
|
use lemmy_db_queries::{source::community::Community_, ApubObject, DbPool, Followable};
|
||||||
source::community::Community_,
|
|
||||||
views::community::community_user_ban_view::CommunityUserBanView,
|
|
||||||
ApubObject,
|
|
||||||
DbPool,
|
|
||||||
Followable,
|
|
||||||
};
|
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
community::{Community, CommunityFollower, CommunityFollowerForm},
|
community::{Community, CommunityFollower, CommunityFollowerForm},
|
||||||
user::User_,
|
user::User_,
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views_actor::community_user_ban_view::CommunityUserBanView;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, LemmyError};
|
use lemmy_utils::{location_info, LemmyError};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
|
|
@ -12,7 +12,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use actix_web::HttpRequest;
|
use actix_web::HttpRequest;
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use lemmy_db::{source::activity::Activity_, ApubObject, DbPool};
|
use lemmy_db_queries::{source::activity::Activity_, ApubObject, DbPool};
|
||||||
use lemmy_db_schema::source::{activity::Activity, community::Community, user::User_};
|
use lemmy_db_schema::source::{activity::Activity, community::Community, user::User_};
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||||
|
|
|
@ -41,7 +41,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use diesel::result::Error::NotFound;
|
use diesel::result::Error::NotFound;
|
||||||
use lemmy_db::{ApubObject, Crud};
|
use lemmy_db_queries::{ApubObject, Crud};
|
||||||
use lemmy_db_schema::source::{comment::Comment, post::Post, site::Site};
|
use lemmy_db_schema::source::{comment::Comment, post::Post, site::Site};
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, LemmyError};
|
use lemmy_utils::{location_info, LemmyError};
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
use activitystreams::{activity::ActorAndObject, prelude::*};
|
use activitystreams::{activity::ActorAndObject, prelude::*};
|
||||||
use actix_web::{web, HttpRequest, HttpResponse};
|
use actix_web::{web, HttpRequest, HttpResponse};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{ApubObject, DbPool};
|
use lemmy_db_queries::{ApubObject, DbPool};
|
||||||
use lemmy_db_schema::source::community::Community;
|
use lemmy_db_schema::source::community::Community;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, LemmyError};
|
use lemmy_utils::{location_info, LemmyError};
|
||||||
|
|
|
@ -48,7 +48,7 @@ use activitystreams::{
|
||||||
use actix_web::{web, HttpRequest, HttpResponse};
|
use actix_web::{web, HttpRequest, HttpResponse};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use diesel::NotFound;
|
use diesel::NotFound;
|
||||||
use lemmy_db::{source::user::User, ApubObject, Followable};
|
use lemmy_db_queries::{source::user::User, ApubObject, Followable};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
community::{Community, CommunityFollower},
|
community::{Community, CommunityFollower},
|
||||||
private_message::PrivateMessage,
|
private_message::PrivateMessage,
|
||||||
|
|
|
@ -22,7 +22,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use activitystreams_ext::{Ext1, Ext2};
|
use activitystreams_ext::{Ext1, Ext2};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use lemmy_db::{source::activity::Activity_, DbPool};
|
use lemmy_db_queries::{source::activity::Activity_, DbPool};
|
||||||
use lemmy_db_schema::source::{activity::Activity, user::User_};
|
use lemmy_db_schema::source::{activity::Activity, user::User_};
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||||
|
|
|
@ -23,7 +23,7 @@ use activitystreams::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use lemmy_db::{Crud, DbPool};
|
use lemmy_db_queries::{Crud, DbPool};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
comment::{Comment, CommentForm},
|
comment::{Comment, CommentForm},
|
||||||
community::Community,
|
community::Community,
|
||||||
|
|
|
@ -22,11 +22,12 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use activitystreams_ext::Ext2;
|
use activitystreams_ext::Ext2;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{views::community::community_moderator_view::CommunityModeratorView, DbPool};
|
use lemmy_db_queries::DbPool;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
naive_now,
|
naive_now,
|
||||||
source::community::{Community, CommunityForm},
|
source::community::{Community, CommunityForm},
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views_actor::community_moderator_view::CommunityModeratorView;
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
location_info,
|
location_info,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use lemmy_db::{ApubObject, Crud, DbPool};
|
use lemmy_db_queries::{ApubObject, Crud, DbPool};
|
||||||
use lemmy_structs::blocking;
|
use lemmy_structs::blocking;
|
||||||
use lemmy_utils::{location_info, settings::Settings, utils::convert_datetime, LemmyError};
|
use lemmy_utils::{location_info, settings::Settings, utils::convert_datetime, LemmyError};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
|
|
@ -20,7 +20,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use activitystreams_ext::Ext1;
|
use activitystreams_ext::Ext1;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{Crud, DbPool};
|
use lemmy_db_queries::{Crud, DbPool};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
community::Community,
|
community::Community,
|
||||||
post::{Post, PostForm},
|
post::{Post, PostForm},
|
||||||
|
|
|
@ -19,7 +19,7 @@ use activitystreams::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{Crud, DbPool};
|
use lemmy_db_queries::{Crud, DbPool};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
private_message::{PrivateMessage, PrivateMessageForm},
|
private_message::{PrivateMessage, PrivateMessageForm},
|
||||||
user::User_,
|
user::User_,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use activitystreams::{
|
||||||
};
|
};
|
||||||
use activitystreams_ext::Ext1;
|
use activitystreams_ext::Ext1;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use lemmy_db::{ApubObject, DbPool};
|
use lemmy_db_queries::{ApubObject, DbPool};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
naive_now,
|
naive_now,
|
||||||
source::user::{UserForm, User_},
|
source::user::{UserForm, User_},
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
pub mod comment_report_view;
|
|
||||||
pub mod comment_view;
|
|
||||||
pub mod community;
|
|
||||||
pub mod moderator;
|
|
||||||
pub mod post_report_view;
|
|
||||||
pub mod post_view;
|
|
||||||
pub mod private_message_view;
|
|
||||||
pub mod site_view;
|
|
||||||
pub mod user_mention_view;
|
|
||||||
pub mod user_view;
|
|
||||||
|
|
||||||
pub(crate) trait ViewToVec {
|
|
||||||
type DbTuple;
|
|
||||||
fn from_tuple_to_vec(tuple: Vec<Self::DbTuple>) -> Vec<Self>
|
|
||||||
where
|
|
||||||
Self: Sized;
|
|
||||||
}
|
|
|
@ -1,10 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lemmy_db"
|
name = "lemmy_db_queries"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "lemmy_db"
|
name = "lemmy_db_queries"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
|
@ -24,18 +24,18 @@ impl CommentAggregates {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
aggregates::comment_aggregates::CommentAggregates,
|
aggregates::comment_aggregates::CommentAggregates,
|
||||||
source::{
|
establish_unpooled_connection,
|
||||||
comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
|
|
||||||
community::{Community, CommunityForm},
|
|
||||||
post::{Post, PostForm},
|
|
||||||
user::{UserForm, User_},
|
|
||||||
},
|
|
||||||
tests::establish_unpooled_connection,
|
|
||||||
Crud,
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
ListingType,
|
ListingType,
|
||||||
SortType,
|
SortType,
|
||||||
};
|
};
|
||||||
|
use lemmy_db_schema::source::{
|
||||||
|
comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
|
||||||
|
community::{Community, CommunityForm},
|
||||||
|
post::{Post, PostForm},
|
||||||
|
user::{UserForm, User_},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_crud() {
|
fn test_crud() {
|
|
@ -24,7 +24,7 @@ impl CommunityAggregates {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
aggregates::community_aggregates::CommunityAggregates,
|
aggregates::community_aggregates::CommunityAggregates,
|
||||||
tests::establish_unpooled_connection,
|
establish_unpooled_connection,
|
||||||
Crud,
|
Crud,
|
||||||
Followable,
|
Followable,
|
||||||
ListingType,
|
ListingType,
|
|
@ -26,7 +26,7 @@ impl PostAggregates {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
aggregates::post_aggregates::PostAggregates,
|
aggregates::post_aggregates::PostAggregates,
|
||||||
tests::establish_unpooled_connection,
|
establish_unpooled_connection,
|
||||||
Crud,
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
ListingType,
|
ListingType,
|
|
@ -23,7 +23,7 @@ impl SiteAggregates {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
aggregates::site_aggregates::SiteAggregates,
|
aggregates::site_aggregates::SiteAggregates,
|
||||||
tests::establish_unpooled_connection,
|
establish_unpooled_connection,
|
||||||
Crud,
|
Crud,
|
||||||
ListingType,
|
ListingType,
|
||||||
SortType,
|
SortType,
|
||||||
|
@ -32,6 +32,7 @@ mod tests {
|
||||||
comment::{Comment, CommentForm},
|
comment::{Comment, CommentForm},
|
||||||
community::{Community, CommunityForm},
|
community::{Community, CommunityForm},
|
||||||
post::{Post, PostForm},
|
post::{Post, PostForm},
|
||||||
|
site::{Site, SiteForm},
|
||||||
user::{UserForm, User_},
|
user::{UserForm, User_},
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl UserAggregates {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
aggregates::user_aggregates::UserAggregates,
|
aggregates::user_aggregates::UserAggregates,
|
||||||
tests::establish_unpooled_connection,
|
establish_unpooled_connection,
|
||||||
Crud,
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
ListingType,
|
ListingType,
|
|
@ -16,7 +16,6 @@ use std::{env, env::VarError};
|
||||||
|
|
||||||
pub mod aggregates;
|
pub mod aggregates;
|
||||||
pub mod source;
|
pub mod source;
|
||||||
pub mod views;
|
|
||||||
|
|
||||||
pub type DbPool = diesel::r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::PgConnection>>;
|
pub type DbPool = diesel::r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::PgConnection>>;
|
||||||
|
|
||||||
|
@ -133,11 +132,18 @@ impl<T> MaybeOptional<T> for Option<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait ToSafe {
|
pub trait ToSafe {
|
||||||
type SafeColumns;
|
type SafeColumns;
|
||||||
fn safe_columns_tuple() -> Self::SafeColumns;
|
fn safe_columns_tuple() -> Self::SafeColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait ViewToVec {
|
||||||
|
type DbTuple;
|
||||||
|
fn from_tuple_to_vec(tuple: Vec<Self::DbTuple>) -> Vec<Self>
|
||||||
|
where
|
||||||
|
Self: Sized;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_database_url_from_env() -> Result<String, VarError> {
|
pub fn get_database_url_from_env() -> Result<String, VarError> {
|
||||||
env::var("LEMMY_DATABASE_URL")
|
env::var("LEMMY_DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
@ -202,25 +208,6 @@ pub fn diesel_option_overwrite(opt: &Option<String>) -> Option<Option<String>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
static ref EMAIL_REGEX: Regex =
|
|
||||||
Regex::new(r"^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$").unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) mod functions {
|
|
||||||
use diesel::sql_types::*;
|
|
||||||
|
|
||||||
sql_function! {
|
|
||||||
fn hot_rank(score: BigInt, time: Timestamp) -> Integer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::fuzzy_search;
|
|
||||||
use crate::{get_database_url_from_env, is_email_regex};
|
|
||||||
use diesel::{Connection, PgConnection};
|
|
||||||
|
|
||||||
embed_migrations!();
|
embed_migrations!();
|
||||||
|
|
||||||
pub fn establish_unpooled_connection() -> PgConnection {
|
pub fn establish_unpooled_connection() -> PgConnection {
|
||||||
|
@ -237,6 +224,24 @@ mod tests {
|
||||||
conn
|
conn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref EMAIL_REGEX: Regex =
|
||||||
|
Regex::new(r"^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod functions {
|
||||||
|
use diesel::sql_types::*;
|
||||||
|
|
||||||
|
sql_function! {
|
||||||
|
fn hot_rank(score: BigInt, time: Timestamp) -> Integer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::fuzzy_search;
|
||||||
|
use crate::is_email_regex;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fuzzy_search() {
|
fn test_fuzzy_search() {
|
||||||
let test = "This is a fuzzy search";
|
let test = "This is a fuzzy search";
|
|
@ -87,7 +87,13 @@ impl Activity_ for Activity {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{tests::establish_unpooled_connection, Crud, ListingType, SortType};
|
use crate::{
|
||||||
|
establish_unpooled_connection,
|
||||||
|
source::activity::Activity_,
|
||||||
|
Crud,
|
||||||
|
ListingType,
|
||||||
|
SortType,
|
||||||
|
};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
activity::{Activity, ActivityForm},
|
activity::{Activity, ActivityForm},
|
||||||
user::{UserForm, User_},
|
user::{UserForm, User_},
|
|
@ -36,7 +36,7 @@ impl Category_ for Category {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::tests::establish_unpooled_connection;
|
use crate::{establish_unpooled_connection, source::category::Category_};
|
||||||
use lemmy_db_schema::source::category::Category;
|
use lemmy_db_schema::source::category::Category;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
|
@ -204,14 +204,7 @@ impl Saveable<CommentSavedForm> for CommentSaved {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{establish_unpooled_connection, Crud, Likeable, ListingType, Saveable, SortType};
|
||||||
tests::establish_unpooled_connection,
|
|
||||||
Crud,
|
|
||||||
Likeable,
|
|
||||||
ListingType,
|
|
||||||
Saveable,
|
|
||||||
SortType,
|
|
||||||
};
|
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
comment::*,
|
comment::*,
|
||||||
community::{Community, CommunityForm},
|
community::{Community, CommunityForm},
|
|
@ -1,11 +1,4 @@
|
||||||
use crate::{
|
use crate::{ApubObject, Bannable, Crud, Followable, Joinable};
|
||||||
views::{community::community_moderator_view::CommunityModeratorView, user_view::UserViewSafe},
|
|
||||||
ApubObject,
|
|
||||||
Bannable,
|
|
||||||
Crud,
|
|
||||||
Followable,
|
|
||||||
Joinable,
|
|
||||||
};
|
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
naive_now,
|
naive_now,
|
||||||
|
@ -138,9 +131,7 @@ pub trait Community_ {
|
||||||
community_id: i32,
|
community_id: i32,
|
||||||
new_creator_id: i32,
|
new_creator_id: i32,
|
||||||
) -> Result<Community, Error>;
|
) -> Result<Community, Error>;
|
||||||
fn community_mods_and_admins(conn: &PgConnection, community_id: i32) -> Result<Vec<i32>, Error>;
|
|
||||||
fn distinct_federated_communities(conn: &PgConnection) -> Result<Vec<String>, Error>;
|
fn distinct_federated_communities(conn: &PgConnection) -> Result<Vec<String>, Error>;
|
||||||
fn is_mod_or_admin(conn: &PgConnection, user_id: i32, community_id: i32) -> bool;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Community_ for Community {
|
impl Community_ for Community {
|
||||||
|
@ -196,27 +187,10 @@ impl Community_ for Community {
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn community_mods_and_admins(conn: &PgConnection, community_id: i32) -> Result<Vec<i32>, Error> {
|
|
||||||
let mut mods_and_admins: Vec<i32> = Vec::new();
|
|
||||||
mods_and_admins.append(
|
|
||||||
&mut CommunityModeratorView::for_community(conn, community_id)
|
|
||||||
.map(|v| v.into_iter().map(|m| m.moderator.id).collect())?,
|
|
||||||
);
|
|
||||||
mods_and_admins
|
|
||||||
.append(&mut UserViewSafe::admins(conn).map(|v| v.into_iter().map(|a| a.user.id).collect())?);
|
|
||||||
Ok(mods_and_admins)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn distinct_federated_communities(conn: &PgConnection) -> Result<Vec<String>, Error> {
|
fn distinct_federated_communities(conn: &PgConnection) -> Result<Vec<String>, Error> {
|
||||||
use lemmy_db_schema::schema::community::dsl::*;
|
use lemmy_db_schema::schema::community::dsl::*;
|
||||||
community.select(actor_id).distinct().load::<String>(conn)
|
community.select(actor_id).distinct().load::<String>(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_mod_or_admin(conn: &PgConnection, user_id: i32, community_id: i32) -> bool {
|
|
||||||
Self::community_mods_and_admins(conn, community_id)
|
|
||||||
.unwrap_or_default()
|
|
||||||
.contains(&user_id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Joinable<CommunityModeratorForm> for CommunityModerator {
|
impl Joinable<CommunityModeratorForm> for CommunityModerator {
|
||||||
|
@ -347,7 +321,7 @@ impl Followable<CommunityFollowerForm> for CommunityFollower {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
tests::establish_unpooled_connection,
|
establish_unpooled_connection,
|
||||||
Bannable,
|
Bannable,
|
||||||
Crud,
|
Crud,
|
||||||
Followable,
|
Followable,
|
|
@ -197,7 +197,7 @@ impl Crud<ModAddForm> for ModAdd {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{tests::establish_unpooled_connection, Crud, ListingType, SortType};
|
use crate::{establish_unpooled_connection, Crud, ListingType, SortType};
|
||||||
use lemmy_db_schema::source::{comment::*, community::*, moderator::*, post::*, user::*};
|
use lemmy_db_schema::source::{comment::*, community::*, moderator::*, post::*, user::*};
|
||||||
|
|
||||||
// use Crud;
|
// use Crud;
|
|
@ -72,7 +72,13 @@ fn bytes_to_hex(bytes: Vec<u8>) -> String {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{tests::establish_unpooled_connection, Crud, ListingType, SortType};
|
use crate::{
|
||||||
|
establish_unpooled_connection,
|
||||||
|
source::password_reset_request::PasswordResetRequest_,
|
||||||
|
Crud,
|
||||||
|
ListingType,
|
||||||
|
SortType,
|
||||||
|
};
|
||||||
use lemmy_db_schema::source::{password_reset_request::PasswordResetRequest, user::*};
|
use lemmy_db_schema::source::{password_reset_request::PasswordResetRequest, user::*};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
|
@ -225,7 +225,7 @@ impl Readable<PostReadForm> for PostRead {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{source::post::*, tests::establish_unpooled_connection, ListingType, SortType};
|
use crate::{establish_unpooled_connection, source::post::*, ListingType, SortType};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
community::{Community, CommunityForm},
|
community::{Community, CommunityForm},
|
||||||
user::*,
|
user::*,
|
|
@ -139,7 +139,13 @@ impl PrivateMessage_ for PrivateMessage {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{tests::establish_unpooled_connection, ListingType, SortType};
|
use crate::{
|
||||||
|
establish_unpooled_connection,
|
||||||
|
source::private_message::PrivateMessage_,
|
||||||
|
Crud,
|
||||||
|
ListingType,
|
||||||
|
SortType,
|
||||||
|
};
|
||||||
use lemmy_db_schema::source::{private_message::*, user::*};
|
use lemmy_db_schema::source::{private_message::*, user::*};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
|
@ -297,7 +297,7 @@ impl User for User_ {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{source::user::*, tests::establish_unpooled_connection, ListingType, SortType};
|
use crate::{establish_unpooled_connection, source::user::*, ListingType, SortType};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_crud() {
|
fn test_crud() {
|
|
@ -73,7 +73,7 @@ impl UserMention_ for UserMention {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{tests::establish_unpooled_connection, Crud, ListingType, SortType};
|
use crate::{establish_unpooled_connection, Crud, ListingType, SortType};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
comment::*,
|
comment::*,
|
||||||
community::{Community, CommunityForm},
|
community::{Community, CommunityForm},
|
|
@ -6,7 +6,7 @@ use chrono::NaiveDateTime;
|
||||||
pub mod schema;
|
pub mod schema;
|
||||||
pub mod source;
|
pub mod source;
|
||||||
|
|
||||||
// TODO: can probably move this back to lemmy_db
|
// TODO: can probably move this back to lemmy_db_queries
|
||||||
pub fn naive_now() -> NaiveDateTime {
|
pub fn naive_now() -> NaiveDateTime {
|
||||||
chrono::prelude::Utc::now().naive_utc()
|
chrono::prelude::Utc::now().naive_utc()
|
||||||
}
|
}
|
||||||
|
|
10
lemmy_db_views/Cargo.toml
Normal file
10
lemmy_db_views/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "lemmy_db_views"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||||
|
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||||
|
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||||
|
serde = { version = "1.0.118", features = ["derive"] }
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, MaybeOptional, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{comment, comment_report, community, post, user_, user_alias_1, user_alias_2},
|
schema::{comment, comment_report, community, post, user_, user_alias_1, user_alias_2},
|
||||||
source::{
|
source::{
|
|
@ -1,15 +1,15 @@
|
||||||
use crate::{
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{
|
||||||
aggregates::comment_aggregates::CommentAggregates,
|
aggregates::comment_aggregates::CommentAggregates,
|
||||||
functions::hot_rank,
|
functions::hot_rank,
|
||||||
fuzzy_search,
|
fuzzy_search,
|
||||||
limit_and_offset,
|
limit_and_offset,
|
||||||
views::ViewToVec,
|
|
||||||
ListingType,
|
ListingType,
|
||||||
MaybeOptional,
|
MaybeOptional,
|
||||||
SortType,
|
SortType,
|
||||||
ToSafe,
|
ToSafe,
|
||||||
|
ViewToVec,
|
||||||
};
|
};
|
||||||
use diesel::{result::Error, *};
|
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{
|
schema::{
|
||||||
comment,
|
comment,
|
||||||
|
@ -418,7 +418,15 @@ impl ViewToVec for CommentView {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{tests::establish_unpooled_connection, views::comment_view::*, Crud, Likeable, *};
|
use crate::comment_view::*;
|
||||||
|
use lemmy_db_queries::{
|
||||||
|
aggregates::comment_aggregates::CommentAggregates,
|
||||||
|
establish_unpooled_connection,
|
||||||
|
Crud,
|
||||||
|
Likeable,
|
||||||
|
ListingType,
|
||||||
|
SortType,
|
||||||
|
};
|
||||||
use lemmy_db_schema::source::{comment::*, community::*, post::*, user::*};
|
use lemmy_db_schema::source::{comment::*, community::*, post::*, user::*};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
6
lemmy_db_views/src/lib.rs
Normal file
6
lemmy_db_views/src/lib.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
pub mod comment_report_view;
|
||||||
|
pub mod comment_view;
|
||||||
|
pub mod post_report_view;
|
||||||
|
pub mod post_view;
|
||||||
|
pub mod private_message_view;
|
||||||
|
pub mod site_view;
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, MaybeOptional, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, post, post_report, user_, user_alias_1, user_alias_2},
|
schema::{community, post, post_report, user_, user_alias_1, user_alias_2},
|
||||||
source::{
|
source::{
|
|
@ -1,15 +1,15 @@
|
||||||
use crate::{
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{
|
||||||
aggregates::post_aggregates::PostAggregates,
|
aggregates::post_aggregates::PostAggregates,
|
||||||
functions::hot_rank,
|
functions::hot_rank,
|
||||||
fuzzy_search,
|
fuzzy_search,
|
||||||
limit_and_offset,
|
limit_and_offset,
|
||||||
views::ViewToVec,
|
|
||||||
ListingType,
|
ListingType,
|
||||||
MaybeOptional,
|
MaybeOptional,
|
||||||
SortType,
|
SortType,
|
||||||
ToSafe,
|
ToSafe,
|
||||||
|
ViewToVec,
|
||||||
};
|
};
|
||||||
use diesel::{result::Error, *};
|
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{
|
schema::{
|
||||||
community,
|
community,
|
||||||
|
@ -406,13 +406,14 @@ impl ViewToVec for PostView {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::post_view::{PostQueryBuilder, PostView};
|
||||||
|
use lemmy_db_queries::{
|
||||||
aggregates::post_aggregates::PostAggregates,
|
aggregates::post_aggregates::PostAggregates,
|
||||||
tests::establish_unpooled_connection,
|
establish_unpooled_connection,
|
||||||
views::post_view::{PostQueryBuilder, PostView},
|
|
||||||
Crud,
|
Crud,
|
||||||
Likeable,
|
Likeable,
|
||||||
*,
|
ListingType,
|
||||||
|
SortType,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::source::{community::*, post::*, user::*};
|
use lemmy_db_schema::source::{community::*, post::*, user::*};
|
||||||
|
|
||||||
|
@ -539,7 +540,7 @@ mod tests {
|
||||||
let expected_post_listing_no_user = PostView {
|
let expected_post_listing_no_user = PostView {
|
||||||
post: Post {
|
post: Post {
|
||||||
id: inserted_post.id,
|
id: inserted_post.id,
|
||||||
name: post_name.to_owned(),
|
name: post_name,
|
||||||
creator_id: inserted_user.id,
|
creator_id: inserted_user.id,
|
||||||
url: None,
|
url: None,
|
||||||
body: None,
|
body: None,
|
||||||
|
@ -561,7 +562,7 @@ mod tests {
|
||||||
my_vote: None,
|
my_vote: None,
|
||||||
creator: UserSafe {
|
creator: UserSafe {
|
||||||
id: inserted_user.id,
|
id: inserted_user.id,
|
||||||
name: user_name.to_owned(),
|
name: user_name,
|
||||||
preferred_username: None,
|
preferred_username: None,
|
||||||
published: inserted_user.published,
|
published: inserted_user.published,
|
||||||
avatar: None,
|
avatar: None,
|
||||||
|
@ -578,7 +579,7 @@ mod tests {
|
||||||
creator_banned_from_community: false,
|
creator_banned_from_community: false,
|
||||||
community: CommunitySafe {
|
community: CommunitySafe {
|
||||||
id: inserted_community.id,
|
id: inserted_community.id,
|
||||||
name: community_name.to_owned(),
|
name: community_name,
|
||||||
icon: None,
|
icon: None,
|
||||||
removed: false,
|
removed: false,
|
||||||
deleted: false,
|
deleted: false,
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, MaybeOptional, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{private_message, user_, user_alias_1},
|
schema::{private_message, user_, user_alias_1},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{aggregates::site_aggregates::SiteAggregates, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{aggregates::site_aggregates::SiteAggregates, ToSafe};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{site, site_aggregates, user_},
|
schema::{site, site_aggregates, user_},
|
||||||
source::{
|
source::{
|
10
lemmy_db_views_actor/Cargo.toml
Normal file
10
lemmy_db_views_actor/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "lemmy_db_views_actor"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||||
|
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||||
|
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||||
|
serde = { version = "1.0.118", features = ["derive"] }
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, community_follower, user_},
|
schema::{community, community_follower, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, community_moderator, user_},
|
schema::{community, community_moderator, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::ToSafe;
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::ToSafe;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, community_user_ban, user_},
|
schema::{community, community_user_ban, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,14 +1,15 @@
|
||||||
use crate::{
|
use crate::{community_moderator_view::CommunityModeratorView, user_view::UserViewSafe};
|
||||||
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{
|
||||||
aggregates::community_aggregates::CommunityAggregates,
|
aggregates::community_aggregates::CommunityAggregates,
|
||||||
functions::hot_rank,
|
functions::hot_rank,
|
||||||
fuzzy_search,
|
fuzzy_search,
|
||||||
limit_and_offset,
|
limit_and_offset,
|
||||||
views::ViewToVec,
|
|
||||||
MaybeOptional,
|
MaybeOptional,
|
||||||
SortType,
|
SortType,
|
||||||
ToSafe,
|
ToSafe,
|
||||||
|
ViewToVec,
|
||||||
};
|
};
|
||||||
use diesel::{result::Error, *};
|
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{category, community, community_aggregates, community_follower, user_},
|
schema::{category, community, community_aggregates, community_follower, user_},
|
||||||
source::{
|
source::{
|
||||||
|
@ -74,6 +75,24 @@ impl CommunityView {
|
||||||
counts,
|
counts,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: this function is only used by is_mod_or_admin() below, can probably be merged
|
||||||
|
fn community_mods_and_admins(conn: &PgConnection, community_id: i32) -> Result<Vec<i32>, Error> {
|
||||||
|
let mut mods_and_admins: Vec<i32> = Vec::new();
|
||||||
|
mods_and_admins.append(
|
||||||
|
&mut CommunityModeratorView::for_community(conn, community_id)
|
||||||
|
.map(|v| v.into_iter().map(|m| m.moderator.id).collect())?,
|
||||||
|
);
|
||||||
|
mods_and_admins
|
||||||
|
.append(&mut UserViewSafe::admins(conn).map(|v| v.into_iter().map(|a| a.user.id).collect())?);
|
||||||
|
Ok(mods_and_admins)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_mod_or_admin(conn: &PgConnection, user_id: i32, community_id: i32) -> bool {
|
||||||
|
Self::community_mods_and_admins(conn, community_id)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.contains(&user_id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CommunityQueryBuilder<'a> {
|
pub struct CommunityQueryBuilder<'a> {
|
|
@ -2,3 +2,5 @@ pub mod community_follower_view;
|
||||||
pub mod community_moderator_view;
|
pub mod community_moderator_view;
|
||||||
pub mod community_user_ban_view;
|
pub mod community_user_ban_view;
|
||||||
pub mod community_view;
|
pub mod community_view;
|
||||||
|
pub mod user_mention_view;
|
||||||
|
pub mod user_view;
|
|
@ -1,13 +1,13 @@
|
||||||
use crate::{
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{
|
||||||
aggregates::comment_aggregates::CommentAggregates,
|
aggregates::comment_aggregates::CommentAggregates,
|
||||||
functions::hot_rank,
|
functions::hot_rank,
|
||||||
limit_and_offset,
|
limit_and_offset,
|
||||||
views::ViewToVec,
|
|
||||||
MaybeOptional,
|
MaybeOptional,
|
||||||
SortType,
|
SortType,
|
||||||
ToSafe,
|
ToSafe,
|
||||||
|
ViewToVec,
|
||||||
};
|
};
|
||||||
use diesel::{result::Error, *};
|
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{
|
schema::{
|
||||||
comment,
|
comment,
|
|
@ -1,13 +1,13 @@
|
||||||
use crate::{
|
use diesel::{dsl::*, result::Error, *};
|
||||||
|
use lemmy_db_queries::{
|
||||||
aggregates::user_aggregates::UserAggregates,
|
aggregates::user_aggregates::UserAggregates,
|
||||||
fuzzy_search,
|
fuzzy_search,
|
||||||
limit_and_offset,
|
limit_and_offset,
|
||||||
views::ViewToVec,
|
|
||||||
MaybeOptional,
|
MaybeOptional,
|
||||||
SortType,
|
SortType,
|
||||||
ToSafe,
|
ToSafe,
|
||||||
|
ViewToVec,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{user_, user_aggregates},
|
schema::{user_, user_aggregates},
|
||||||
source::user::{UserSafe, User_},
|
source::user::{UserSafe, User_},
|
10
lemmy_db_views_moderator/Cargo.toml
Normal file
10
lemmy_db_views_moderator/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "lemmy_db_views_moderator"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||||
|
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||||
|
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||||
|
serde = { version = "1.0.118", features = ["derive"] }
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, mod_add_community, user_, user_alias_1},
|
schema::{community, mod_add_community, user_, user_alias_1},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{mod_add, user_, user_alias_1},
|
schema::{mod_add, user_, user_alias_1},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, mod_ban_from_community, user_, user_alias_1},
|
schema::{community, mod_ban_from_community, user_, user_alias_1},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{mod_ban, user_, user_alias_1},
|
schema::{mod_ban, user_, user_alias_1},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, mod_lock_post, post, user_},
|
schema::{community, mod_lock_post, post, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{comment, community, mod_remove_comment, post, user_, user_alias_1},
|
schema::{comment, community, mod_remove_comment, post, user_, user_alias_1},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, mod_remove_community, user_},
|
schema::{community, mod_remove_community, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, mod_remove_post, post, user_},
|
schema::{community, mod_remove_post, post, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{limit_and_offset, views::ViewToVec, ToSafe};
|
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
|
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
schema::{community, mod_sticky_post, post, user_},
|
schema::{community, mod_sticky_post, post, user_},
|
||||||
source::{
|
source::{
|
|
@ -1,18 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "lemmy_rate_limit"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Felix Ableitner <me@nutomic.com>"]
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "lemmy_rate_limit"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
lemmy_utils = { path = "../lemmy_utils" }
|
|
||||||
tokio = { version = "0.3.6", features = ["sync"] }
|
|
||||||
strum = "0.20.0"
|
|
||||||
strum_macros = "0.20.1"
|
|
||||||
futures = "0.3.8"
|
|
||||||
actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
|
|
||||||
log = "0.4.11"
|
|
|
@ -9,7 +9,10 @@ name = "lemmy_structs"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db = { path = "../lemmy_db" }
|
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||||
|
lemmy_db_views = { path = "../lemmy_db_views" }
|
||||||
|
lemmy_db_views_moderator = { path = "../lemmy_db_views_moderator" }
|
||||||
|
lemmy_db_views_actor = { path = "../lemmy_db_views_actor" }
|
||||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||||
lemmy_utils = { path = "../lemmy_utils" }
|
lemmy_utils = { path = "../lemmy_utils" }
|
||||||
serde = { version = "1.0.118", features = ["derive"] }
|
serde = { version = "1.0.118", features = ["derive"] }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use lemmy_db::views::{comment_report_view::CommentReportView, comment_view::CommentView};
|
use lemmy_db_views::{comment_report_view::CommentReportView, comment_view::CommentView};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
use lemmy_db::views::{
|
use lemmy_db_views_actor::{
|
||||||
community::{
|
|
||||||
community_follower_view::CommunityFollowerView,
|
community_follower_view::CommunityFollowerView,
|
||||||
community_moderator_view::CommunityModeratorView,
|
community_moderator_view::CommunityModeratorView,
|
||||||
community_view::CommunityView,
|
community_view::CommunityView,
|
||||||
},
|
|
||||||
user_view::UserViewSafe,
|
user_view::UserViewSafe,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -5,7 +5,7 @@ pub mod site;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
|
|
||||||
use diesel::PgConnection;
|
use diesel::PgConnection;
|
||||||
use lemmy_db::{source::user::User, Crud, DbPool};
|
use lemmy_db_queries::{source::user::User, Crud, DbPool};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
comment::Comment,
|
comment::Comment,
|
||||||
post::Post,
|
post::Post,
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
use lemmy_db::views::{
|
use lemmy_db_views::{
|
||||||
comment_view::CommentView,
|
comment_view::CommentView,
|
||||||
community::{community_moderator_view::CommunityModeratorView, community_view::CommunityView},
|
|
||||||
post_report_view::PostReportView,
|
post_report_view::PostReportView,
|
||||||
post_view::PostView,
|
post_view::PostView,
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views_actor::{
|
||||||
|
community_moderator_view::CommunityModeratorView,
|
||||||
|
community_view::CommunityView,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use lemmy_db::views::{
|
use lemmy_db_schema::source::{category::*, user::User_};
|
||||||
comment_view::CommentView,
|
use lemmy_db_views::{comment_view::CommentView, post_view::PostView, site_view::SiteView};
|
||||||
community::community_view::CommunityView,
|
use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
|
||||||
moderator::{
|
use lemmy_db_views_moderator::{
|
||||||
mod_add_community_view::ModAddCommunityView,
|
mod_add_community_view::ModAddCommunityView,
|
||||||
mod_add_view::ModAddView,
|
mod_add_view::ModAddView,
|
||||||
mod_ban_from_community_view::ModBanFromCommunityView,
|
mod_ban_from_community_view::ModBanFromCommunityView,
|
||||||
|
@ -11,12 +11,7 @@ use lemmy_db::views::{
|
||||||
mod_remove_community_view::ModRemoveCommunityView,
|
mod_remove_community_view::ModRemoveCommunityView,
|
||||||
mod_remove_post_view::ModRemovePostView,
|
mod_remove_post_view::ModRemovePostView,
|
||||||
mod_sticky_post_view::ModStickyPostView,
|
mod_sticky_post_view::ModStickyPostView,
|
||||||
},
|
|
||||||
post_view::PostView,
|
|
||||||
site_view::SiteView,
|
|
||||||
user_view::UserViewSafe,
|
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::source::{category::*, user::User_};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue