- let form = PostForm {
- name: page.name.clone(),
- url: url.map(Into::into),
- body: body_slurs_removed,
- creator_id: creator.id,
- community_id: community.id,
- removed: None,
- locked: page.comments_enabled.map(|e| !e),
- published: page.published.map(|u| u.naive_local()),
- updated: page.updated.map(|u| u.naive_local()),
- deleted: None,
- nsfw: page.sensitive,
- stickied: page.stickied,
- embed_title,
- embed_description,
- embed_html,
- thumbnail_url: pictrs_thumbnail.map(|u| u.into()),
- ap_id: Some(page.id.clone().into()),
- local: Some(false),
+ PostForm {
+ name: page.name.clone(),
+ url: url.map(Into::into),
+ body: body_slurs_removed,
+ creator_id: creator.id,
+ community_id: community.id,
+ removed: None,
+ locked: page.comments_enabled.map(|e| !e),
+ published: page.published.map(|u| u.naive_local()),
+ updated: page.updated.map(|u| u.naive_local()),
+ deleted: None,
+ nsfw: page.sensitive,
+ stickied: page.stickied,
+ embed_title,
+ embed_description,
+ embed_html,
+ thumbnail_url: pictrs_thumbnail.map(|u| u.into()),
+ ap_id: Some(page.id.clone().into()),
+ local: Some(false),
+ }
+ } else {
+ // if is mod action, only update locked/stickied fields, nothing else
+ PostForm {
+ name: page.name.clone(),
+ creator_id: creator.id,
+ community_id: community.id,
+ locked: page.comments_enabled.map(|e| !e),
+ stickied: page.stickied,
+ updated: page.updated.map(|u| u.naive_local()),
+ ap_id: Some(page.id.clone().into()),
+ ..Default::default()
+ }