]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/protocol/objects/page.rs
Add support for Featured Posts (#2585)
[lemmy.git] / crates / apub / src / protocol / objects / page.rs
index b25e1d97c742161596659a7eee9396ebcf0eba2e..3aadb20c1a2ba5660e83c03f68c87568a25518e4 100644 (file)
@@ -20,9 +20,9 @@ use activitystreams_kinds::{
 };
 use chrono::{DateTime, FixedOffset};
 use itertools::Itertools;
+use lemmy_api_common::context::LemmyContext;
 use lemmy_db_schema::newtypes::DbUrl;
 use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
 use serde::{Deserialize, Serialize};
 use serde_with::skip_serializing_none;
 use url::Url;
@@ -54,9 +54,6 @@ pub struct Page {
   pub(crate) media_type: Option<MediaTypeMarkdownOrHtml>,
   #[serde(deserialize_with = "deserialize_skip_error", default)]
   pub(crate) source: Option<Source>,
-  /// deprecated, use attachment field
-  #[serde(deserialize_with = "deserialize_skip_error", default)]
-  pub(crate) url: Option<Url>,
   /// most software uses array type for attachment field, so we do the same. nevertheless, we only
   /// use the first item
   #[serde(default)]
@@ -140,18 +137,18 @@ impl Page {
       .dereference_local(context)
       .await;
 
-    let stickied_changed = Page::is_stickied_changed(&old_post, &self.stickied);
+    let featured_changed = Page::is_featured_changed(&old_post, &self.stickied);
     let locked_changed = Page::is_locked_changed(&old_post, &self.comments_enabled);
-    Ok(stickied_changed || locked_changed)
+    Ok(featured_changed || locked_changed)
   }
 
-  pub(crate) fn is_stickied_changed<E>(
+  pub(crate) fn is_featured_changed<E>(
     old_post: &Result<ApubPost, E>,
-    new_stickied: &Option<bool>,
+    new_featured_community: &Option<bool>,
   ) -> bool {
-    if let Some(new_stickied) = new_stickied {
+    if let Some(new_featured_community) = new_featured_community {
       if let Ok(old_post) = old_post {
-        return new_stickied != &old_post.stickied;
+        return new_featured_community != &old_post.featured_community;
       }
     }