- /// Both stickied and locked need to be false on a newly created post (verified in [[CreatePost]].
- pub(crate) async fn is_mod_action(&self, context: &LemmyContext) -> Result<bool, LemmyError> {
- let old_post = ObjectId::<ApubPost>::new(self.id.clone())
- .dereference_local(context)
- .await;
-
- let stickied_changed = Page::is_stickied_changed(&old_post, &self.stickied);
- let locked_changed = Page::is_locked_changed(&old_post, &self.comments_enabled);
- Ok(stickied_changed || locked_changed)
- }
-
- pub(crate) fn is_stickied_changed<E>(
- old_post: &Result<ApubPost, E>,
- new_stickied: &Option<bool>,
- ) -> bool {
- if let Some(new_stickied) = new_stickied {
- if let Ok(old_post) = old_post {
- return new_stickied != &old_post.stickied;
- }
- }
-
- false
+ /// Locked needs to be false on a newly created post (verified in [[CreatePost]].
+ pub(crate) async fn is_mod_action(
+ &self,
+ context: &Data<LemmyContext>,
+ ) -> Result<bool, LemmyError> {
+ let old_post = self.id.clone().dereference_local(context).await;
+ Ok(Page::is_locked_changed(&old_post, &self.comments_enabled))