diff --git a/Cargo.lock b/Cargo.lock index 0bcba9ff..5d088062 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1810,7 +1810,6 @@ dependencies = [ "ructe 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "serde_qs 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "validator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1892,7 +1891,6 @@ dependencies = [ "rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tantivy 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index d4dee03b..7be8872f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ rocket_i18n = "0.4.0" rpassword = "2.0" scheduled-thread-pool = "0.2.0" serde = "1.0" -serde_derive = "1.0" serde_json = "1.0" serde_qs = "0.4" validator = "0.8" diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 0f5b3d3e..c15a14bd 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -1,4 +1,4 @@ -use activitypub::{Activity, Actor, Link, Object}; +use activitypub::{Activity, Link, Object}; use array_tool::vec::Uniq; use reqwest::Client; use rocket::{ @@ -106,7 +106,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest { .unwrap_or(Outcome::Forward(())) } } -pub fn broadcast( +pub fn broadcast( sender: &S, act: A, to: Vec, diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index ba899cc7..d79a098d 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -18,7 +18,6 @@ rocket = "0.4.0" reqwest = "0.9" scheduled-thread-pool = "0.2.0" serde = "1.0" -serde_derive = "1.0" serde_json = "1.0" tantivy = "0.8.2" url = "1.7" diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index e5bcd3a5..2f61e628 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -1,4 +1,4 @@ -use activitypub::{actor::Group, collection::OrderedCollection, Actor, CustomObject, Object}; +use activitypub::{actor::Group, collection::OrderedCollection, CustomObject}; use chrono::NaiveDateTime; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use openssl::{ @@ -30,7 +30,7 @@ use {Connection, BASE_URL, USE_HTTPS, Error, Result}; pub type CustomGroup = CustomObject; -#[derive(Queryable, Identifiable, Serialize, Deserialize, Clone, AsChangeset)] +#[derive(Queryable, Identifiable, Clone, AsChangeset)] pub struct Blog { pub id: i32, pub actor_id: String, @@ -363,9 +363,6 @@ impl IntoId for Blog { } } -impl Object for Blog {} -impl Actor for Blog {} - impl WithInbox for Blog { fn get_inbox_url(&self) -> String { self.inbox_url.clone() diff --git a/plume-models/src/comment_seers.rs b/plume-models/src/comment_seers.rs index 89c5d283..7d5a87f4 100644 --- a/plume-models/src/comment_seers.rs +++ b/plume-models/src/comment_seers.rs @@ -5,7 +5,7 @@ use schema::comment_seers; use users::User; use {Connection, Error, Result}; -#[derive(Queryable, Serialize, Clone)] +#[derive(Queryable, Clone)] pub struct CommentSeers { pub id: i32, pub comment_id: i32, diff --git a/plume-models/src/comments.rs b/plume-models/src/comments.rs index 144050f6..44ea8e40 100644 --- a/plume-models/src/comments.rs +++ b/plume-models/src/comments.rs @@ -20,7 +20,7 @@ use schema::comments; use users::User; use {Connection, Error, Result}; -#[derive(Queryable, Identifiable, Serialize, Clone, AsChangeset)] +#[derive(Queryable, Identifiable, Clone, AsChangeset)] pub struct Comment { pub id: i32, pub content: SafeString, diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index 68da4ce6..c4cf77b4 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -1,7 +1,6 @@ use activitypub::{ activity::{Accept, Follow as FollowAct, Undo}, actor::Person, - Actor, }; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; @@ -74,7 +73,7 @@ impl Follow { /// from -> The one sending the follow request /// target -> The target of the request, responding with Accept - pub fn accept_follow( + pub fn accept_follow( conn: &Connection, from: &B, target: &A, diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index 5936d030..a921d1f6 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -9,7 +9,7 @@ use schema::{instances, users}; use users::User; use {Connection, Error, Result}; -#[derive(Clone, Identifiable, Queryable, Serialize)] +#[derive(Clone, Identifiable, Queryable)] pub struct Instance { pub id: i32, pub public_domain: String, diff --git a/plume-models/src/lib.rs b/plume-models/src/lib.rs index 823ae687..a9041394 100644 --- a/plume-models/src/lib.rs +++ b/plume-models/src/lib.rs @@ -21,8 +21,6 @@ extern crate rocket; extern crate scheduled_thread_pool; extern crate serde; #[macro_use] -extern crate serde_derive; -#[macro_use] extern crate serde_json; #[macro_use] extern crate tantivy; diff --git a/plume-models/src/medias.rs b/plume-models/src/medias.rs index 08bfb932..cc1ed965 100644 --- a/plume-models/src/medias.rs +++ b/plume-models/src/medias.rs @@ -13,7 +13,7 @@ use schema::medias; use users::User; use {ap_url, Connection, Error, Result}; -#[derive(Clone, Identifiable, Queryable, Serialize)] +#[derive(Clone, Identifiable, Queryable)] pub struct Media { pub id: i32, pub file_path: String, diff --git a/plume-models/src/mentions.rs b/plume-models/src/mentions.rs index b9a06ef2..db4d9fd2 100644 --- a/plume-models/src/mentions.rs +++ b/plume-models/src/mentions.rs @@ -9,7 +9,7 @@ use schema::mentions; use users::User; use {Connection, Error, Result}; -#[derive(Clone, Queryable, Identifiable, Serialize, Deserialize)] +#[derive(Clone, Queryable, Identifiable)] pub struct Mention { pub id: i32, pub mentioned_id: i32, diff --git a/plume-models/src/notifications.rs b/plume-models/src/notifications.rs index b916c16f..8d40294e 100644 --- a/plume-models/src/notifications.rs +++ b/plume-models/src/notifications.rs @@ -19,7 +19,7 @@ pub mod notification_kind { pub const RESHARE: &str = "RESHARE"; } -#[derive(Clone, Queryable, Identifiable, Serialize)] +#[derive(Clone, Queryable, Identifiable)] pub struct Notification { pub id: i32, pub user_id: i32, diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 39f6f5bb..b31c7c9e 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -34,7 +34,7 @@ use {ap_url, Connection, BASE_URL, Error, Result, ApiResult}; pub type LicensedArticle = CustomObject; -#[derive(Queryable, Identifiable, Serialize, Clone, AsChangeset)] +#[derive(Queryable, Identifiable, Clone, AsChangeset)] #[changeset_options(treat_none_as_null = "true")] pub struct Post { pub id: i32, diff --git a/plume-models/src/reshares.rs b/plume-models/src/reshares.rs index 5b656fd3..829b37ec 100644 --- a/plume-models/src/reshares.rs +++ b/plume-models/src/reshares.rs @@ -12,7 +12,7 @@ use schema::reshares; use users::User; use {Connection, Error, Result}; -#[derive(Clone, Serialize, Deserialize, Queryable, Identifiable)] +#[derive(Clone, Queryable, Identifiable)] pub struct Reshare { pub id: i32, pub user_id: i32, diff --git a/plume-models/src/tags.rs b/plume-models/src/tags.rs index 91c2b57a..1b4f412b 100644 --- a/plume-models/src/tags.rs +++ b/plume-models/src/tags.rs @@ -5,7 +5,7 @@ use plume_common::activity_pub::Hashtag; use schema::tags; use {ap_url, Connection, Error, Result}; -#[derive(Clone, Identifiable, Serialize, Queryable)] +#[derive(Clone, Identifiable, Queryable)] pub struct Tag { pub id: i32, pub tag: String, diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 0e394815..7ace4c38 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -1,6 +1,6 @@ use activitypub::{ - actor::Person, collection::OrderedCollection, object::Image, Activity, Actor, CustomObject, - Endpoint, Object, + actor::Person, collection::OrderedCollection, object::Image, Activity, CustomObject, + Endpoint, }; use bcrypt; use chrono::{NaiveDateTime, Utc}; @@ -44,7 +44,7 @@ use {ap_url, Connection, BASE_URL, USE_HTTPS, Error, Result}; pub type CustomPerson = CustomObject; -#[derive(Queryable, Identifiable, Serialize, Deserialize, Clone, Debug, AsChangeset)] +#[derive(Queryable, Identifiable, Clone, Debug, AsChangeset)] pub struct User { pub id: i32, pub username: String, @@ -829,8 +829,6 @@ impl IntoId for User { } impl Eq for User {} -impl Object for User {} -impl Actor for User {} impl WithInbox for User { fn get_inbox_url(&self) -> String { diff --git a/src/main.rs b/src/main.rs index 995c6d09..4949d6ec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,8 +30,6 @@ extern crate rocket_i18n; extern crate scheduled_thread_pool; extern crate serde; #[macro_use] -extern crate serde_derive; -#[macro_use] extern crate serde_json; extern crate serde_qs; extern crate validator; diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 4a70a7e1..63f199b0 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -66,7 +66,7 @@ pub fn new_auth(i18n: I18n) -> Flash{ ) } -#[derive(Default, FromForm, Validate, Serialize)] +#[derive(Default, FromForm, Validate)] pub struct NewBlogForm { #[validate(custom(function = "valid_slug", message = "Invalid name"))] pub title: String, diff --git a/src/routes/comments.rs b/src/routes/comments.rs index f2f80b12..69ee487a 100644 --- a/src/routes/comments.rs +++ b/src/routes/comments.rs @@ -25,7 +25,7 @@ use plume_models::{ use Worker; use routes::errors::ErrorPage; -#[derive(Default, FromForm, Debug, Validate, Serialize)] +#[derive(Default, FromForm, Debug, Validate)] pub struct NewCommentForm { pub responding_to: Option, #[validate(length(min = "1", message = "Your comment can't be empty"))] diff --git a/src/routes/instance.rs b/src/routes/instance.rs index bdf605ad..5f9121d1 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -103,7 +103,7 @@ pub fn admin(conn: DbConn, admin: Admin, intl: I18n) -> Result ))) } -#[derive(Clone, FromForm, Validate, Serialize)] +#[derive(Clone, FromForm, Validate)] pub struct InstanceSettingsForm { #[validate(length(min = "1"))] pub name: String, diff --git a/src/routes/posts.rs b/src/routes/posts.rs index 46bb1ab1..2dc33056 100644 --- a/src/routes/posts.rs +++ b/src/routes/posts.rs @@ -272,7 +272,7 @@ pub fn update(blog: String, slug: String, user: User, cl: ContentLen, form: Leni } } -#[derive(Default, FromForm, Validate, Serialize)] +#[derive(Default, FromForm, Validate)] pub struct NewPostForm { #[validate(custom(function = "valid_slug", message = "Invalid title"))] pub title: String, diff --git a/src/routes/session.rs b/src/routes/session.rs index 0128507b..c7f16f9c 100644 --- a/src/routes/session.rs +++ b/src/routes/session.rs @@ -29,7 +29,7 @@ pub fn new(user: Option, conn: DbConn, m: Option, intl: I18n) -> R )) } -#[derive(Default, FromForm, Validate, Serialize)] +#[derive(Default, FromForm, Validate)] pub struct LoginForm { #[validate(length(min = "1", message = "We need an email or a username to identify you"))] pub email_or_name: String, diff --git a/src/routes/user.rs b/src/routes/user.rs index 35dbe813..398f6f80 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -276,7 +276,7 @@ pub fn delete(name: String, conn: DbConn, user: User, mut cookies: Cookies, sear } } -#[derive(Default, FromForm, Serialize, Validate)] +#[derive(Default, FromForm, Validate)] #[validate( schema( function = "passwords_match",