From: Felix Ableitner Date: Mon, 22 Feb 2021 18:34:41 +0000 (+0100) Subject: Use `name` field for post titles instead of `summary` (ref #1220) X-Git-Url: http://these/git/%22%7Burl%7D/%7B%60%24%7BghostArchiveUrl%7D/%7B%60/feeds/inbox/%24%7BUserService.Instance.auth%7D.xml%60%7D?a=commitdiff_plain;h=8d5e9f865c833aca3c1398b8c2bf82ef90e24a83;p=lemmy.git Use `name` field for post titles instead of `summary` (ref #1220) --- diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 097480cf..d3d9dfb8 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -58,8 +58,9 @@ impl ToApub for Post { // https://git.asonix.dog/Aardwolf/activitystreams/issues/5 .set_many_contexts(lemmy_context()?) .set_id(self.ap_id.to_owned().into_inner()) - // Use summary field to be consistent with mastodon content warning. - // https://mastodon.xyz/@Louisa/103987265222901387.json + .set_name(self.name.to_owned()) + // `summary` field for compatibility with lemmy v0.9.9 and older, + // TODO: remove this after some time .set_summary(self.name.to_owned()) .set_published(convert_datetime(self.published)) .set_many_tos(vec![community.actor_id.into_inner(), public()]) @@ -174,8 +175,11 @@ impl FromApubToForm for PostForm { let name = page .inner - .summary() - .as_ref() + .name() + .map(|s| s.map(|s2| s2.to_owned())) + // The following is for compatibility with lemmy v0.9.9 and older + // TODO: remove it after some time (along with the map above) + .or_else(|| page.inner.summary().map(|s| s.to_owned())) .context(location_info!())? .as_single_xsd_string() .context(location_info!())?