]> Untitled Git - lemmy.git/blobdiff - crates/api/src/post/sticky.rs
Moving settings to Database. (#2492)
[lemmy.git] / crates / api / src / post / sticky.rs
index dffe67e3394fe8344cf9fa55d4eece84bdfdf8b8..629de9d664b3c3ffdd724d1cf91489ec7bfd4c33 100644 (file)
@@ -17,11 +17,11 @@ use lemmy_apub::{
 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)]
@@ -61,7 +61,11 @@ impl Perform for StickyPost {
     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();