use crate::Perform;
use actix_web::web::Data;
use lemmy_api_common::{
- blocking,
- check_community_ban,
- check_community_deleted_or_removed,
- get_local_user_view_from_jwt,
- is_mod_or_admin,
post::{PostResponse, StickyPost},
+ utils::{
+ blocking,
+ check_community_ban,
+ check_community_deleted_or_removed,
+ get_local_user_view_from_jwt,
+ is_mod_or_admin,
+ },
};
use lemmy_apub::{
objects::post::ApubPost,
use lemmy_db_schema::{
source::{
moderator::{ModStickyPost, ModStickyPostForm},
- post::Post,
+ post::{Post, PostUpdateForm},
},
traits::Crud,
};
-use lemmy_utils::{ConnectionId, LemmyError};
+use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
let post_id = data.post_id;
let stickied = data.stickied;
let updated_post: ApubPost = blocking(context.pool(), move |conn| {
- Post::update_stickied(conn, post_id, stickied)
+ Post::update(
+ conn,
+ post_id,
+ &PostUpdateForm::builder().stickied(Some(stickied)).build(),
+ )
})
.await??
.into();