use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, TokenData, Validation};
-use lemmy_db::user::User_;
+use lemmy_db::source::user::User_;
use lemmy_utils::settings::Settings;
use serde::{Deserialize, Serialize};
use actix_web::web::Data;
use lemmy_apub::{ApubLikeableType, ApubObjectType};
use lemmy_db::{
- comment::*,
comment_report::*,
comment_view::*,
- moderator::*,
- post::*,
- user::*,
+ source::{comment::*, moderator::*, post::*, user::*},
views::site_view::SiteView,
Crud,
Likeable,
use anyhow::Context;
use lemmy_apub::ActorType;
use lemmy_db::{
- comment::Comment,
comment_view::CommentQueryBuilder,
- community::*,
diesel_option_overwrite,
- moderator::*,
naive_now,
- post::Post,
- site::*,
+ source::{comment::Comment, community::*, moderator::*, post::Post, site::*},
views::{
community_follower_view::CommunityFollowerView,
community_moderator_view::CommunityModeratorView,
use crate::claims::Claims;
use actix_web::{web, web::Data};
use lemmy_db::{
- community::{Community, CommunityModerator},
- post::Post,
- user::User_,
+ source::{
+ community::{Community, CommunityModerator},
+ post::Post,
+ user::User_,
+ },
views::community_user_ban_view::CommunityUserBanView,
Crud,
DbPool,
use lemmy_apub::{ApubLikeableType, ApubObjectType};
use lemmy_db::{
comment_view::*,
- moderator::*,
naive_now,
- post::*,
post_report::*,
+ source::{moderator::*, post::*},
views::{
community_moderator_view::CommunityModeratorView,
community_view::CommunityView,
use lemmy_apub::fetcher::search_by_apub_id;
use lemmy_db::{
aggregates::site_aggregates::SiteAggregates,
- category::*,
comment_view::*,
diesel_option_overwrite,
- moderator::*,
moderator_views::*,
naive_now,
- site::*,
+ source::{category::*, moderator::*, site::*},
views::{
community_view::CommunityQueryBuilder,
post_view::PostQueryBuilder,
use chrono::Duration;
use lemmy_apub::ApubObjectType;
use lemmy_db::{
- comment::*,
comment_report::CommentReportView,
comment_view::*,
- community::*,
diesel_option_overwrite,
- moderator::*,
naive_now,
- password_reset_request::*,
- post::*,
post_report::PostReportView,
- private_message::*,
private_message_view::*,
- site::*,
- user::*,
- user_mention::*,
+ source::{
+ comment::*,
+ community::*,
+ moderator::*,
+ password_reset_request::*,
+ post::*,
+ private_message::*,
+ site::*,
+ user::*,
+ user_mention::*,
+ },
user_mention_view::*,
views::{
community_follower_view::CommunityFollowerView,
};
use anyhow::Context;
use lemmy_db::{
- comment::{Comment, CommentLike, CommentLikeForm},
comment_view::CommentView,
- post::Post,
+ source::{
+ comment::{Comment, CommentLike, CommentLikeForm},
+ post::Post,
+ },
Likeable,
};
use lemmy_structs::{blocking, comment::CommentResponse, send_local_notifs};
use crate::activities::receive::get_actor_as_user;
use activitystreams::activity::{Dislike, Like};
use lemmy_db::{
- comment::{Comment, CommentLike},
comment_view::CommentView,
+ source::comment::{Comment, CommentLike},
Likeable,
};
use lemmy_structs::{blocking, comment::CommentResponse};
base::{AnyBase, ExtendsExt},
};
use anyhow::Context;
-use lemmy_db::{community::Community, views::community_view::CommunityView, ApubObject};
+use lemmy_db::{source::community::Community, views::community_view::CommunityView, ApubObject};
use lemmy_structs::{blocking, community::CommunityResponse};
use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
error::DomainError,
};
use anyhow::{anyhow, Context};
-use lemmy_db::user::User_;
+use lemmy_db::source::user::User_;
use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::LemmyContext;
use log::debug;
};
use anyhow::Context;
use lemmy_db::{
- post::{Post, PostLike, PostLikeForm},
+ source::post::{Post, PostLike, PostLikeForm},
views::post_view::PostView,
Likeable,
};
use crate::activities::receive::get_actor_as_user;
use activitystreams::activity::{Dislike, Like};
use lemmy_db::{
- post::{Post, PostLike},
+ source::post::{Post, PostLike},
views::post_view::PostView,
Likeable,
};
public,
};
use anyhow::{anyhow, Context};
-use lemmy_db::{private_message::PrivateMessage, private_message_view::PrivateMessageView};
+use lemmy_db::{private_message_view::PrivateMessageView, source::private_message::PrivateMessage};
use lemmy_structs::{blocking, user::PrivateMessageResponse};
use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperation};
};
use anyhow::anyhow;
use itertools::Itertools;
-use lemmy_db::{comment::Comment, community::Community, post::Post, user::User_, Crud, DbPool};
+use lemmy_db::{
+ source::{comment::Comment, community::Community, post::Post, user::User_},
+ Crud,
+ DbPool,
+};
use lemmy_structs::{blocking, WebFingerResponse};
use lemmy_utils::{
request::{retry, RecvError},
use anyhow::Context;
use itertools::Itertools;
use lemmy_db::{
- community::Community,
+ source::community::Community,
views::community_follower_view::CommunityFollowerView,
DbPool,
};
prelude::*,
public,
};
-use lemmy_db::{community::Community, post::Post, user::User_, Crud};
+use lemmy_db::{
+ source::{community::Community, post::Post, user::User_},
+ Crud,
+};
use lemmy_structs::blocking;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
},
prelude::*,
};
-use lemmy_db::{private_message::PrivateMessage, user::User_, Crud};
+use lemmy_db::{
+ source::{private_message::PrivateMessage, user::User_},
+ Crud,
+};
use lemmy_structs::blocking;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
object::ObjectExt,
};
use lemmy_db::{
- community::{Community, CommunityFollower, CommunityFollowerForm},
- user::User_,
+ source::{
+ community::{Community, CommunityFollower, CommunityFollowerForm},
+ user::User_,
+ },
ApubObject,
DbPool,
Followable,
WorkerConfig,
};
use itertools::Itertools;
-use lemmy_db::{community::Community, user::User_, DbPool};
+use lemmy_db::{
+ source::{community::Community, user::User_},
+ DbPool,
+};
use lemmy_utils::{location_info, settings::Settings, LemmyError};
use lemmy_websocket::LemmyContext;
use log::{debug, warn};
use activitystreams::unparsed::UnparsedMutExt;
use activitystreams_ext::UnparsedExtension;
use diesel::PgConnection;
-use lemmy_db::{category::Category, Crud};
+use lemmy_db::{source::category::Category, Crud};
use lemmy_utils::LemmyError;
use serde::{Deserialize, Serialize};
use chrono::NaiveDateTime;
use diesel::result::Error::NotFound;
use lemmy_db::{
- comment::Comment,
comment_view::CommentView,
- community::{Community, CommunityModerator, CommunityModeratorForm},
naive_now,
- post::Post,
- user::User_,
+ source::{
+ comment::Comment,
+ community::{Community, CommunityModerator, CommunityModeratorForm},
+ post::Post,
+ user::User_,
+ },
views::{community_view::CommunityView, post_view::PostView, user_view::UserViewSafe},
ApubObject,
Joinable,
};
use actix_web::{body::Body, web, web::Path, HttpResponse};
use diesel::result::Error::NotFound;
-use lemmy_db::{comment::Comment, Crud};
+use lemmy_db::{source::comment::Comment, Crud};
use lemmy_structs::blocking;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
};
use actix_web::{body::Body, web, HttpResponse};
use lemmy_db::{
- community::Community,
- post::Post,
+ source::{community::Community, post::Post},
views::community_follower_view::CommunityFollowerView,
};
use lemmy_structs::blocking;
use crate::APUB_JSON_CONTENT_TYPE;
use actix_web::{body::Body, web, HttpResponse};
-use lemmy_db::activity::Activity;
+use lemmy_db::source::activity::Activity;
use lemmy_structs::blocking;
use lemmy_utils::{settings::Settings, LemmyError};
use lemmy_websocket::LemmyContext;
};
use actix_web::{body::Body, web, HttpResponse};
use diesel::result::Error::NotFound;
-use lemmy_db::post::Post;
+use lemmy_db::source::post::Post;
use lemmy_structs::blocking;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
collection::{CollectionExt, OrderedCollection},
};
use actix_web::{body::Body, web, HttpResponse};
-use lemmy_db::user::User_;
+use lemmy_db::source::user::User_;
use lemmy_structs::blocking;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use actix_web::{web, HttpRequest, HttpResponse};
use anyhow::{anyhow, Context};
use lemmy_db::{
- community::{Community, CommunityFollower, CommunityFollowerForm},
- user::User_,
+ source::{
+ community::{Community, CommunityFollower, CommunityFollowerForm},
+ user::User_,
+ },
views::community_user_ban_view::CommunityUserBanView,
ApubObject,
DbPool,
};
use actix_web::HttpRequest;
use anyhow::{anyhow, Context};
-use lemmy_db::{activity::Activity, community::Community, user::User_, ApubObject, DbPool};
+use lemmy_db::{
+ source::{activity::Activity, community::Community, user::User_},
+ ApubObject,
+ DbPool,
+};
use lemmy_structs::blocking;
use lemmy_utils::{location_info, settings::Settings, LemmyError};
use lemmy_websocket::LemmyContext;
};
use anyhow::Context;
use diesel::result::Error::NotFound;
-use lemmy_db::{comment::Comment, post::Post, site::Site, ApubObject, Crud};
+use lemmy_db::{
+ source::{comment::Comment, post::Post, site::Site},
+ ApubObject,
+ Crud,
+};
use lemmy_structs::blocking;
use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::LemmyContext;
use activitystreams::{activity::ActorAndObject, prelude::*};
use actix_web::{web, HttpRequest, HttpResponse};
use anyhow::Context;
-use lemmy_db::{community::Community, ApubObject, DbPool};
+use lemmy_db::{source::community::Community, ApubObject, DbPool};
use lemmy_structs::blocking;
use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::LemmyContext;
use anyhow::{anyhow, Context};
use diesel::NotFound;
use lemmy_db::{
- community::{Community, CommunityFollower},
- private_message::PrivateMessage,
- user::User_,
+ source::{
+ community::{Community, CommunityFollower},
+ private_message::PrivateMessage,
+ user::User_,
+ },
ApubObject,
Followable,
};
};
use activitystreams_ext::{Ext1, Ext2};
use anyhow::{anyhow, Context};
-use lemmy_db::{activity::Activity, user::User_, DbPool};
+use lemmy_db::{
+ source::{activity::Activity, user::User_},
+ DbPool,
+};
use lemmy_structs::blocking;
use lemmy_utils::{location_info, settings::Settings, LemmyError};
use lemmy_websocket::LemmyContext;
};
use anyhow::{anyhow, Context};
use lemmy_db::{
- comment::{Comment, CommentForm},
- community::Community,
- post::Post,
- user::User_,
+ source::{
+ comment::{Comment, CommentForm},
+ community::Community,
+ post::Post,
+ user::User_,
+ },
Crud,
DbPool,
};
use activitystreams_ext::Ext2;
use anyhow::Context;
use lemmy_db::{
- community::{Community, CommunityForm},
naive_now,
+ source::community::{Community, CommunityForm},
views::community_moderator_view::CommunityModeratorView,
DbPool,
};
use activitystreams_ext::Ext1;
use anyhow::Context;
use lemmy_db::{
- community::Community,
- post::{Post, PostForm},
- user::User_,
+ source::{
+ community::Community,
+ post::{Post, PostForm},
+ user::User_,
+ },
Crud,
DbPool,
};
};
use anyhow::Context;
use lemmy_db::{
- private_message::{PrivateMessage, PrivateMessageForm},
- user::User_,
+ source::{
+ private_message::{PrivateMessage, PrivateMessageForm},
+ user::User_,
+ },
Crud,
DbPool,
};
use anyhow::Context;
use lemmy_db::{
naive_now,
- user::{UserForm, User_},
+ source::user::{UserForm, User_},
ApubObject,
DbPool,
};
mod tests {
use crate::{
aggregates::community_aggregates::CommunityAggregates,
- comment::{Comment, CommentForm},
- community::{Community, CommunityFollower, CommunityFollowerForm, CommunityForm},
- post::{Post, PostForm},
+ source::{
+ comment::{Comment, CommentForm},
+ community::{Community, CommunityFollower, CommunityFollowerForm, CommunityForm},
+ post::{Post, PostForm},
+ user::{UserForm, User_},
+ },
tests::establish_unpooled_connection,
- user::{UserForm, User_},
Crud,
Followable,
ListingType,
mod tests {
use crate::{
aggregates::post_aggregates::PostAggregates,
- comment::{Comment, CommentForm},
- community::{Community, CommunityForm},
- post::{Post, PostForm, PostLike, PostLikeForm},
+ source::{
+ comment::{Comment, CommentForm},
+ community::{Community, CommunityForm},
+ post::{Post, PostForm, PostLike, PostLikeForm},
+ user::{UserForm, User_},
+ },
tests::establish_unpooled_connection,
- user::{UserForm, User_},
Crud,
Likeable,
ListingType,
mod tests {
use crate::{
aggregates::site_aggregates::SiteAggregates,
- comment::{Comment, CommentForm},
- community::{Community, CommunityForm},
- post::{Post, PostForm},
+ source::{
+ comment::{Comment, CommentForm},
+ community::{Community, CommunityForm},
+ post::{Post, PostForm},
+ user::{UserForm, User_},
+ },
tests::establish_unpooled_connection,
- user::{UserForm, User_},
Crud,
ListingType,
SortType,
mod tests {
use crate::{
aggregates::user_aggregates::UserAggregates,
- comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
- community::{Community, CommunityForm},
- post::{Post, PostForm, PostLike, PostLikeForm},
+ source::{
+ comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
+ community::{Community, CommunityForm},
+ post::{Post, PostForm, PostLike, PostLikeForm},
+ user::{UserForm, User_},
+ },
tests::establish_unpooled_connection,
- user::{UserForm, User_},
Crud,
Likeable,
ListingType,
use serde::{Deserialize, Serialize};
use crate::{
- comment::Comment,
limit_and_offset,
naive_now,
schema::comment_report,
+ source::comment::Comment,
MaybeOptional,
Reportable,
};
#[cfg(test)]
mod tests {
use crate::{
- comment::*,
comment_view::*,
- community::*,
- post::*,
+ source::{comment::*, community::*, post::*, user::*},
tests::establish_unpooled_connection,
- user::*,
Crud,
Likeable,
*,
use serde::{Deserialize, Serialize};
use std::{env, env::VarError};
-pub mod activity;
-pub mod aggregates;
-pub mod category;
-pub mod comment;
pub mod comment_report;
pub mod comment_view;
-pub mod community;
-pub mod moderator;
pub mod moderator_views;
-pub mod password_reset_request;
-pub mod post;
pub mod post_report;
-pub mod private_message;
pub mod private_message_view;
-pub mod schema;
-pub mod site;
-pub mod user;
-pub mod user_mention;
pub mod user_mention_view;
+
+pub mod aggregates;
+pub mod schema;
+pub mod source;
pub mod views;
pub type DbPool = diesel::r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::PgConnection>>;
use crate::{
limit_and_offset,
naive_now,
- post::Post,
schema::post_report,
+ source::post::Post,
MaybeOptional,
Reportable,
};
#[cfg(test)]
mod tests {
use crate::{
- activity::{Activity, ActivityForm},
+ source::{
+ activity::{Activity, ActivityForm},
+ user::{UserForm, User_},
+ },
tests::establish_unpooled_connection,
- user::{UserForm, User_},
Crud,
ListingType,
SortType,
#[cfg(test)]
mod tests {
- use crate::{category::Category, tests::establish_unpooled_connection};
+ use crate::{source::category::Category, tests::establish_unpooled_connection};
#[test]
fn test_crud() {
#[cfg(test)]
mod tests {
use crate::{
- comment::*,
- community::*,
- post::*,
+ source::{comment::*, community::*, post::*, user::*},
tests::establish_unpooled_connection,
- user::*,
Crud,
ListingType,
SortType,
}
mod safe_type {
- use crate::{community::Community, schema::community::columns::*, ToSafe};
+ use crate::{schema::community::columns::*, source::community::Community, ToSafe};
type Columns = (
id,
name,
#[cfg(test)]
mod tests {
- use crate::{community::*, tests::establish_unpooled_connection, user::*, ListingType, SortType};
+ use crate::{
+ source::{community::*, user::*},
+ tests::establish_unpooled_connection,
+ ListingType,
+ SortType,
+ };
#[test]
fn test_crud() {
--- /dev/null
+pub mod activity;
+pub mod category;
+pub mod comment;
+pub mod community;
+pub mod moderator;
+pub mod password_reset_request;
+pub mod post;
+pub mod private_message;
+pub mod site;
+pub mod user;
+pub mod user_mention;
#[cfg(test)]
mod tests {
use crate::{
- comment::*,
- community::*,
- moderator::*,
- post::*,
+ source::{comment::*, community::*, moderator::*, post::*, user::*},
tests::establish_unpooled_connection,
- user::*,
ListingType,
SortType,
};
mod tests {
use super::super::user::*;
use crate::{
- password_reset_request::PasswordResetRequest,
+ source::password_reset_request::PasswordResetRequest,
tests::establish_unpooled_connection,
Crud,
ListingType,
#[cfg(test)]
mod tests {
use crate::{
- community::*,
- post::*,
+ source::{community::*, post::*, user::*},
tests::establish_unpooled_connection,
- user::*,
ListingType,
SortType,
};
#[cfg(test)]
mod tests {
use crate::{
- private_message::*,
+ source::{private_message::*, user::*},
tests::establish_unpooled_connection,
- user::*,
ListingType,
SortType,
};
}
mod safe_type {
- use crate::{schema::user_::columns::*, user::User_, ToSafe};
+ use crate::{schema::user_::columns::*, source::user::User_, ToSafe};
type Columns = (
id,
name,
#[cfg(test)]
mod tests {
- use crate::{tests::establish_unpooled_connection, user::*, ListingType, SortType};
+ use crate::{source::user::*, tests::establish_unpooled_connection, ListingType, SortType};
#[test]
fn test_crud() {
#[cfg(test)]
mod tests {
use crate::{
- comment::*,
- community::*,
- post::*,
+ source::{comment::*, community::*, post::*, user::*, user_mention::*},
tests::establish_unpooled_connection,
- user::*,
- user_mention::*,
ListingType,
SortType,
};
use crate::{
- community::{Community, CommunitySafe},
schema::{community, community_follower, user_},
- user::{UserSafe, User_},
+ source::{
+ community::{Community, CommunitySafe},
+ user::{UserSafe, User_},
+ },
views::ViewToVec,
ToSafe,
};
use crate::{
- community::{Community, CommunitySafe},
schema::{community, community_moderator, user_},
- user::{UserSafe, User_},
+ source::{
+ community::{Community, CommunitySafe},
+ user::{UserSafe, User_},
+ },
views::ViewToVec,
ToSafe,
};
use crate::{
- community::{Community, CommunitySafe},
schema::{community, community_user_ban, user_},
- user::{UserSafe, User_},
+ source::{
+ community::{Community, CommunitySafe},
+ user::{UserSafe, User_},
+ },
ToSafe,
};
use diesel::{result::Error, *};
use crate::{
aggregates::community_aggregates::CommunityAggregates,
- category::Category,
- community::{Community, CommunityFollower, CommunitySafe},
functions::hot_rank,
fuzzy_search,
limit_and_offset,
schema::{category, community, community_aggregates, community_follower, user_},
- user::{UserSafe, User_},
+ source::{
+ category::Category,
+ community::{Community, CommunityFollower, CommunitySafe},
+ user::{UserSafe, User_},
+ },
views::ViewToVec,
MaybeOptional,
SortType,
use crate::{
aggregates::post_aggregates::PostAggregates,
- community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan},
functions::hot_rank,
fuzzy_search,
limit_and_offset,
- post::{Post, PostRead, PostSaved},
schema::{
community,
community_follower,
post_saved,
user_,
},
- user::{UserSafe, User_},
+ source::{
+ community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan},
+ post::{Post, PostRead, PostSaved},
+ user::{UserSafe, User_},
+ },
views::ViewToVec,
ListingType,
MaybeOptional,
mod tests {
use crate::{
aggregates::post_aggregates::PostAggregates,
- community::*,
- post::*,
+ source::{community::*, post::*, user::*},
tests::establish_unpooled_connection,
- user::*,
views::post_view::{PostQueryBuilder, PostView},
Crud,
Likeable,
use crate::{
schema::{site, user_},
- site::Site,
- user::{UserSafe, User_},
+ source::{
+ site::Site,
+ user::{UserSafe, User_},
+ },
ToSafe,
};
use diesel::{result::Error, *};
fuzzy_search,
limit_and_offset,
schema::{user_, user_aggregates},
- user::{UserSafe, User_},
+ source::user::{UserSafe, User_},
views::ViewToVec,
MaybeOptional,
SortType,
use diesel::PgConnection;
use lemmy_db::{
- comment::Comment,
- post::Post,
- user::User_,
- user_mention::{UserMention, UserMentionForm},
+ source::{
+ comment::Comment,
+ post::Post,
+ user::User_,
+ user_mention::{UserMention, UserMentionForm},
+ },
Crud,
DbPool,
};
use lemmy_db::{
aggregates::site_aggregates::SiteAggregates,
- category::*,
comment_view::*,
moderator_views::*,
- user::*,
+ source::{category::*, user::*},
views::{
community_view::CommunityView,
post_view::PostView,
*,
};
use lemmy_db::{
- comment::Comment,
- community::{Community, CommunityForm},
naive_now,
- post::Post,
- private_message::PrivateMessage,
- user::{UserForm, User_},
+ source::{
+ comment::Comment,
+ community::{Community, CommunityForm},
+ post::Post,
+ private_message::PrivateMessage,
+ user::{UserForm, User_},
+ },
Crud,
};
use lemmy_utils::{
use lemmy_api::claims::Claims;
use lemmy_db::{
comment_view::{ReplyQueryBuilder, ReplyView},
- community::Community,
- user::User_,
+ source::{community::Community, user::User_},
user_mention_view::{UserMentionQueryBuilder, UserMentionView},
views::{
post_view::{PostQueryBuilder, PostView},
use actix_web::{error::ErrorBadRequest, web::Query, *};
use anyhow::anyhow;
-use lemmy_db::{community::Community, user::User_};
+use lemmy_db::source::{community::Community, user::User_};
use lemmy_structs::{blocking, WebFingerLink, WebFingerResponse};
use lemmy_utils::{
settings::Settings,
},
};
use lemmy_db::{
- community::{Community, CommunityForm},
- user::{User_, *},
+ source::{
+ community::{Community, CommunityForm},
+ user::{User_, *},
+ },
Crud,
ListingType,
SortType,