mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 03:41:02 +00:00
Remove dead code (#81)
Add post_read back in, do some cleanup Add some delete functions back in Merge branch 'main' into remove-dead-code Replace body of unused db functions with unimplemented!() Remove dead code Remove remaining usages of unwrap() from activitypub code Remove most usage of Option::unwrap() from activitypub code Co-authored-by: Felix Ableitner <me@nutomic.com> Reviewed-on: https://yerbamate.dev/LemmyNet/lemmy/pulls/81
This commit is contained in:
parent
49892690ff
commit
aace1bd71e
20 changed files with 22 additions and 205 deletions
|
@ -34,11 +34,6 @@ impl Crud<ActivityForm> for Activity {
|
|||
activity.find(activity_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, activity_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::activity::dsl::*;
|
||||
diesel::delete(activity.find(activity_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, new_activity: &ActivityForm) -> Result<Self, Error> {
|
||||
use crate::schema::activity::dsl::*;
|
||||
insert_into(activity)
|
||||
|
|
|
@ -23,10 +23,6 @@ impl Crud<CategoryForm> for Category {
|
|||
category.find(category_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, category_id: i32) -> Result<usize, Error> {
|
||||
diesel::delete(category.find(category_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, new_category: &CategoryForm) -> Result<Self, Error> {
|
||||
insert_into(category)
|
||||
.values(new_category)
|
||||
|
|
|
@ -172,13 +172,6 @@ pub struct CommentLikeForm {
|
|||
}
|
||||
|
||||
impl Likeable<CommentLikeForm> for CommentLike {
|
||||
fn read(conn: &PgConnection, comment_id_from: i32) -> Result<Vec<Self>, Error> {
|
||||
use crate::schema::comment_like::dsl::*;
|
||||
comment_like
|
||||
.filter(comment_id.eq(comment_id_from))
|
||||
.load::<Self>(conn)
|
||||
}
|
||||
|
||||
fn like(conn: &PgConnection, comment_like_form: &CommentLikeForm) -> Result<Self, Error> {
|
||||
use crate::schema::comment_like::dsl::*;
|
||||
insert_into(comment_like)
|
||||
|
@ -196,15 +189,6 @@ impl Likeable<CommentLikeForm> for CommentLike {
|
|||
}
|
||||
}
|
||||
|
||||
impl CommentLike {
|
||||
pub fn from_post(conn: &PgConnection, post_id_from: i32) -> Result<Vec<Self>, Error> {
|
||||
use crate::schema::comment_like::dsl::*;
|
||||
comment_like
|
||||
.filter(post_id.eq(post_id_from))
|
||||
.load::<Self>(conn)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
|
||||
#[belongs_to(Comment)]
|
||||
#[table_name = "comment_saved"]
|
||||
|
|
|
@ -99,11 +99,6 @@ impl Community {
|
|||
.first::<Self>(conn)
|
||||
}
|
||||
|
||||
pub fn list_local(conn: &PgConnection) -> Result<Vec<Self>, Error> {
|
||||
use crate::schema::community::dsl::*;
|
||||
community.filter(local.eq(true)).load::<Community>(conn)
|
||||
}
|
||||
|
||||
pub fn update_deleted(
|
||||
conn: &PgConnection,
|
||||
community_id: i32,
|
||||
|
|
|
@ -386,20 +386,6 @@ pub struct CommunityUserBanView {
|
|||
}
|
||||
|
||||
impl CommunityUserBanView {
|
||||
pub fn for_community(conn: &PgConnection, from_community_id: i32) -> Result<Vec<Self>, Error> {
|
||||
use super::community_view::community_user_ban_view::dsl::*;
|
||||
community_user_ban_view
|
||||
.filter(community_id.eq(from_community_id))
|
||||
.load::<Self>(conn)
|
||||
}
|
||||
|
||||
pub fn for_user(conn: &PgConnection, from_user_id: i32) -> Result<Vec<Self>, Error> {
|
||||
use super::community_view::community_user_ban_view::dsl::*;
|
||||
community_user_ban_view
|
||||
.filter(user_id.eq(from_user_id))
|
||||
.load::<Self>(conn)
|
||||
}
|
||||
|
||||
pub fn get(
|
||||
conn: &PgConnection,
|
||||
from_user_id: i32,
|
||||
|
|
|
@ -50,9 +50,12 @@ pub trait Crud<T> {
|
|||
fn update(conn: &PgConnection, id: i32, form: &T) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized;
|
||||
fn delete(conn: &PgConnection, id: i32) -> Result<usize, Error>
|
||||
fn delete(_conn: &PgConnection, _id: i32) -> Result<usize, Error>
|
||||
where
|
||||
Self: Sized;
|
||||
Self: Sized,
|
||||
{
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Followable<T> {
|
||||
|
@ -74,9 +77,6 @@ pub trait Joinable<T> {
|
|||
}
|
||||
|
||||
pub trait Likeable<T> {
|
||||
fn read(conn: &PgConnection, id: i32) -> Result<Vec<Self>, Error>
|
||||
where
|
||||
Self: Sized;
|
||||
fn like(conn: &PgConnection, form: &T) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized;
|
||||
|
|
|
@ -41,11 +41,6 @@ impl Crud<ModRemovePostForm> for ModRemovePost {
|
|||
mod_remove_post.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_remove_post::dsl::*;
|
||||
diesel::delete(mod_remove_post.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModRemovePostForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_remove_post::dsl::*;
|
||||
insert_into(mod_remove_post)
|
||||
|
@ -85,11 +80,6 @@ impl Crud<ModLockPostForm> for ModLockPost {
|
|||
mod_lock_post.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_lock_post::dsl::*;
|
||||
diesel::delete(mod_lock_post.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModLockPostForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_lock_post::dsl::*;
|
||||
insert_into(mod_lock_post)
|
||||
|
@ -129,11 +119,6 @@ impl Crud<ModStickyPostForm> for ModStickyPost {
|
|||
mod_sticky_post.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_sticky_post::dsl::*;
|
||||
diesel::delete(mod_sticky_post.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModStickyPostForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_sticky_post::dsl::*;
|
||||
insert_into(mod_sticky_post)
|
||||
|
@ -175,11 +160,6 @@ impl Crud<ModRemoveCommentForm> for ModRemoveComment {
|
|||
mod_remove_comment.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_remove_comment::dsl::*;
|
||||
diesel::delete(mod_remove_comment.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModRemoveCommentForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_remove_comment::dsl::*;
|
||||
insert_into(mod_remove_comment)
|
||||
|
@ -223,11 +203,6 @@ impl Crud<ModRemoveCommunityForm> for ModRemoveCommunity {
|
|||
mod_remove_community.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_remove_community::dsl::*;
|
||||
diesel::delete(mod_remove_community.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_remove_community::dsl::*;
|
||||
insert_into(mod_remove_community)
|
||||
|
@ -277,11 +252,6 @@ impl Crud<ModBanFromCommunityForm> for ModBanFromCommunity {
|
|||
mod_ban_from_community.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_ban_from_community::dsl::*;
|
||||
diesel::delete(mod_ban_from_community.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_ban_from_community::dsl::*;
|
||||
insert_into(mod_ban_from_community)
|
||||
|
@ -329,11 +299,6 @@ impl Crud<ModBanForm> for ModBan {
|
|||
mod_ban.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_ban::dsl::*;
|
||||
diesel::delete(mod_ban.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModBanForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_ban::dsl::*;
|
||||
insert_into(mod_ban).values(form).get_result::<Self>(conn)
|
||||
|
@ -373,11 +338,6 @@ impl Crud<ModAddCommunityForm> for ModAddCommunity {
|
|||
mod_add_community.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_add_community::dsl::*;
|
||||
diesel::delete(mod_add_community.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModAddCommunityForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_add_community::dsl::*;
|
||||
insert_into(mod_add_community)
|
||||
|
@ -417,11 +377,6 @@ impl Crud<ModAddForm> for ModAdd {
|
|||
mod_add.find(from_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, from_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::mod_add::dsl::*;
|
||||
diesel::delete(mod_add.find(from_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, form: &ModAddForm) -> Result<Self, Error> {
|
||||
use crate::schema::mod_add::dsl::*;
|
||||
insert_into(mod_add).values(form).get_result::<Self>(conn)
|
||||
|
|
|
@ -28,9 +28,6 @@ impl Crud<PasswordResetRequestForm> for PasswordResetRequest {
|
|||
.find(password_reset_request_id)
|
||||
.first::<Self>(conn)
|
||||
}
|
||||
fn delete(conn: &PgConnection, password_reset_request_id: i32) -> Result<usize, Error> {
|
||||
diesel::delete(password_reset_request.find(password_reset_request_id)).execute(conn)
|
||||
}
|
||||
fn create(conn: &PgConnection, form: &PasswordResetRequestForm) -> Result<Self, Error> {
|
||||
insert_into(password_reset_request)
|
||||
.values(form)
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
use crate::{
|
||||
naive_now,
|
||||
schema::{post, post_like, post_read, post_saved},
|
||||
Crud,
|
||||
Likeable,
|
||||
Readable,
|
||||
Saveable,
|
||||
};
|
||||
use crate::{naive_now, schema::{post, post_like, post_read, post_saved}, Crud, Likeable, Saveable, Readable};
|
||||
use diesel::{dsl::*, result::Error, *};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::{ParseError, Url};
|
||||
|
@ -201,12 +194,6 @@ pub struct PostLikeForm {
|
|||
}
|
||||
|
||||
impl Likeable<PostLikeForm> for PostLike {
|
||||
fn read(conn: &PgConnection, post_id_from: i32) -> Result<Vec<Self>, Error> {
|
||||
use crate::schema::post_like::dsl::*;
|
||||
post_like
|
||||
.filter(post_id.eq(post_id_from))
|
||||
.load::<Self>(conn)
|
||||
}
|
||||
fn like(conn: &PgConnection, post_like_form: &PostLikeForm) -> Result<Self, Error> {
|
||||
use crate::schema::post_like::dsl::*;
|
||||
insert_into(post_like)
|
||||
|
@ -264,8 +251,11 @@ impl Saveable<PostSavedForm> for PostSaved {
|
|||
#[table_name = "post_read"]
|
||||
pub struct PostRead {
|
||||
pub id: i32,
|
||||
|
||||
pub post_id: i32,
|
||||
|
||||
pub user_id: i32,
|
||||
|
||||
pub published: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
|
@ -273,6 +263,7 @@ pub struct PostRead {
|
|||
#[table_name = "post_read"]
|
||||
pub struct PostReadForm {
|
||||
pub post_id: i32,
|
||||
|
||||
pub user_id: i32,
|
||||
}
|
||||
|
||||
|
@ -283,6 +274,7 @@ impl Readable<PostReadForm> for PostRead {
|
|||
.values(post_read_form)
|
||||
.get_result::<Self>(conn)
|
||||
}
|
||||
|
||||
fn mark_as_unread(conn: &PgConnection, post_read_form: &PostReadForm) -> Result<usize, Error> {
|
||||
use crate::schema::post_read::dsl::*;
|
||||
diesel::delete(
|
||||
|
@ -438,17 +430,17 @@ mod tests {
|
|||
|
||||
// Post Read
|
||||
let post_read_form = PostReadForm {
|
||||
post_id: inserted_post.id,
|
||||
user_id: inserted_user.id,
|
||||
};
|
||||
post_id: inserted_post.id,
|
||||
user_id: inserted_user.id,
|
||||
};
|
||||
|
||||
let inserted_post_read = PostRead::mark_as_read(&conn, &post_read_form).unwrap();
|
||||
|
||||
let expected_post_read = PostRead {
|
||||
id: inserted_post_read.id,
|
||||
post_id: inserted_post.id,
|
||||
user_id: inserted_user.id,
|
||||
published: inserted_post_read.published,
|
||||
id: inserted_post_read.id,
|
||||
post_id: inserted_post.id,
|
||||
user_id: inserted_user.id,
|
||||
published: inserted_post_read.published,
|
||||
};
|
||||
|
||||
let read_post = Post::read(&conn, inserted_post.id).unwrap();
|
||||
|
|
|
@ -252,11 +252,6 @@ impl<'a> PostQueryBuilder<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn unread_only(mut self, unread_only: bool) -> Self {
|
||||
self.unread_only = unread_only;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn page<T: MaybeOptional<i64>>(mut self, page: T) -> Self {
|
||||
self.page = page.get_optional();
|
||||
self
|
||||
|
|
|
@ -37,11 +37,6 @@ impl Crud<PrivateMessageForm> for PrivateMessage {
|
|||
private_message.find(private_message_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, private_message_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::private_message::dsl::*;
|
||||
diesel::delete(private_message.find(private_message_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, private_message_form: &PrivateMessageForm) -> Result<Self, Error> {
|
||||
use crate::schema::private_message::dsl::*;
|
||||
insert_into(private_message)
|
||||
|
|
|
@ -39,11 +39,6 @@ impl Crud<SiteForm> for Site {
|
|||
site.first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, site_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::site::dsl::*;
|
||||
diesel::delete(site.find(site_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, new_site: &SiteForm) -> Result<Self, Error> {
|
||||
use crate::schema::site::dsl::*;
|
||||
insert_into(site).values(new_site).get_result::<Self>(conn)
|
||||
|
|
|
@ -28,11 +28,6 @@ impl Crud<UserMentionForm> for UserMention {
|
|||
user_mention.find(user_mention_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
fn delete(conn: &PgConnection, user_mention_id: i32) -> Result<usize, Error> {
|
||||
use crate::schema::user_mention::dsl::*;
|
||||
diesel::delete(user_mention.find(user_mention_id)).execute(conn)
|
||||
}
|
||||
|
||||
fn create(conn: &PgConnection, user_mention_form: &UserMentionForm) -> Result<Self, Error> {
|
||||
use crate::schema::user_mention::dsl::*;
|
||||
insert_into(user_mention)
|
||||
|
|
|
@ -159,11 +159,6 @@ impl<'a> UserQueryBuilder<'a> {
|
|||
}
|
||||
|
||||
impl UserView {
|
||||
pub fn read(conn: &PgConnection, from_user_id: i32) -> Result<Self, Error> {
|
||||
use super::user_view::user_fast::dsl::*;
|
||||
user_fast.find(from_user_id).first::<Self>(conn)
|
||||
}
|
||||
|
||||
pub fn admins(conn: &PgConnection) -> Result<Vec<Self>, Error> {
|
||||
use super::user_view::user_fast::dsl::*;
|
||||
use diesel::sql_types::{Nullable, Text};
|
||||
|
|
|
@ -12,7 +12,7 @@ pub extern crate url;
|
|||
pub mod settings;
|
||||
|
||||
use crate::settings::Settings;
|
||||
use chrono::{DateTime, FixedOffset, Local, NaiveDateTime, Utc};
|
||||
use chrono::{DateTime, FixedOffset, Local, NaiveDateTime};
|
||||
use itertools::Itertools;
|
||||
use lettre::{
|
||||
smtp::{
|
||||
|
@ -43,10 +43,6 @@ macro_rules! location_info {
|
|||
};
|
||||
}
|
||||
|
||||
pub fn to_datetime_utc(ndt: NaiveDateTime) -> DateTime<Utc> {
|
||||
DateTime::<Utc>::from_utc(ndt, Utc)
|
||||
}
|
||||
|
||||
pub fn naive_from_unix(time: i64) -> NaiveDateTime {
|
||||
NaiveDateTime::from_timestamp(time, 0)
|
||||
}
|
||||
|
|
|
@ -121,10 +121,6 @@ impl Settings {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn api_endpoint(&self) -> String {
|
||||
format!("{}/api/v1", self.hostname)
|
||||
}
|
||||
|
||||
pub fn get_config_defaults_location() -> String {
|
||||
env::var("LEMMY_CONFIG_LOCATION").unwrap_or_else(|_| CONFIG_FILE_DEFAULTS.to_string())
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use diesel::{result::Error, PgConnection};
|
||||
use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, TokenData, Validation};
|
||||
use lemmy_db::{user::User_, Crud};
|
||||
use lemmy_db::user::User_;
|
||||
use lemmy_utils::settings::Settings;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -37,9 +36,4 @@ impl Claims {
|
|||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn find_by_jwt(conn: &PgConnection, jwt: &str) -> Result<User_, Error> {
|
||||
let claims: Claims = Claims::decode(&jwt).expect("Invalid token").claims;
|
||||
User_::read(&conn, claims.id)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use crate::{
|
|||
},
|
||||
blocking,
|
||||
request::{retry, RecvError},
|
||||
routes::nodeinfo::{NodeInfo, NodeInfoWellKnown},
|
||||
DbPool,
|
||||
LemmyError,
|
||||
};
|
||||
|
@ -43,20 +42,6 @@ use url::Url;
|
|||
static ACTOR_REFETCH_INTERVAL_SECONDS: i64 = 24 * 60 * 60;
|
||||
static ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG: i64 = 10;
|
||||
|
||||
// Fetch nodeinfo metadata from a remote instance.
|
||||
async fn _fetch_node_info(client: &Client, domain: &str) -> Result<NodeInfo, LemmyError> {
|
||||
let well_known_uri = Url::parse(&format!(
|
||||
"{}://{}/.well-known/nodeinfo",
|
||||
get_apub_protocol_string(),
|
||||
domain
|
||||
))?;
|
||||
|
||||
let well_known = fetch_remote_object::<NodeInfoWellKnown>(client, &well_known_uri).await?;
|
||||
let nodeinfo = fetch_remote_object::<NodeInfo>(client, &well_known.links.href).await?;
|
||||
|
||||
Ok(nodeinfo)
|
||||
}
|
||||
|
||||
/// Fetch any type of ActivityPub object, handling things like HTTP headers, deserialisation,
|
||||
/// timeouts etc.
|
||||
pub async fn fetch_remote_object<Response>(
|
||||
|
@ -447,26 +432,3 @@ pub async fn get_or_fetch_and_insert_comment(
|
|||
Err(e) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO It should not be fetching data from a community outbox.
|
||||
// All posts, comments, comment likes, etc should be posts to our community_inbox
|
||||
// The only data we should be periodically fetching (if it hasn't been fetched in the last day
|
||||
// maybe), is community and user actors
|
||||
// and user actors
|
||||
// Fetch all posts in the outbox of the given user, and insert them into the database.
|
||||
// fn fetch_community_outbox(community: &Community, conn: &PgConnection) -> Result<Vec<Post>, LemmyError> {
|
||||
// let outbox_url = Url::parse(&community.get_outbox_url())?;
|
||||
// let outbox = fetch_remote_object::<OrderedCollection>(&outbox_url)?;
|
||||
// let items = outbox.collection_props.get_many_items_base_boxes();
|
||||
|
||||
// Ok(
|
||||
// items
|
||||
// .context(location_info!())?
|
||||
// .map(|obox: &BaseBox| -> Result<PostForm, LemmyError> {
|
||||
// let page = obox.clone().to_concrete::<Page>()?;
|
||||
// PostForm::from_page(&page, conn)
|
||||
// })
|
||||
// .map(|pf| upsert_post(&pf?, conn))
|
||||
// .collect::<Result<Vec<Post>, LemmyError>>()?,
|
||||
// )
|
||||
// }
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
extern crate lemmy_server;
|
||||
#[macro_use]
|
||||
extern crate diesel_migrations;
|
||||
#[macro_use]
|
||||
pub extern crate lazy_static;
|
||||
|
||||
pub type DbPool = Pool<ConnectionManager<PgConnection>>;
|
||||
|
||||
use crate::lemmy_server::actix_web::dev::Service;
|
||||
use actix::prelude::*;
|
||||
use actix_web::{
|
||||
body::Body,
|
||||
client::Client,
|
||||
dev::{ServiceRequest, ServiceResponse},
|
||||
dev::{Service, ServiceRequest, ServiceResponse},
|
||||
http::{
|
||||
header::{CACHE_CONTROL, CONTENT_TYPE},
|
||||
HeaderValue,
|
||||
|
|
|
@ -7,15 +7,13 @@ pub mod nodeinfo;
|
|||
pub mod webfinger;
|
||||
pub mod websocket;
|
||||
|
||||
use crate::{rate_limit::rate_limiter::RateLimiter, websocket::server::ChatServer};
|
||||
use crate::websocket::server::ChatServer;
|
||||
use actix::prelude::*;
|
||||
use actix_web::*;
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub type DbPoolParam = web::Data<Pool<ConnectionManager<PgConnection>>>;
|
||||
pub type RateLimitParam = web::Data<Arc<Mutex<RateLimiter>>>;
|
||||
pub type ChatServerParam = web::Data<Addr<ChatServer>>;
|
||||
|
|
Loading…
Reference in a new issue