From 6b31c254b5a7ab6735c625459ba7936d9b2851e6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 23 Oct 2021 05:41:44 +0300 Subject: RSS: add guids --- src/main/java/com/juick/www/rss/MessagesView.java | 13 +++++++++++-- src/main/java/com/juick/www/rss/RepliesView.java | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/juick/www/rss/MessagesView.java b/src/main/java/com/juick/www/rss/MessagesView.java index 54983273..6355c47d 100644 --- a/src/main/java/com/juick/www/rss/MessagesView.java +++ b/src/main/java/com/juick/www/rss/MessagesView.java @@ -35,7 +35,13 @@ import com.rometools.modules.mediarss.types.Metadata; import com.rometools.modules.mediarss.types.Thumbnail; import com.rometools.modules.mediarss.types.UrlReference; import com.rometools.rome.feed.atom.Link; -import com.rometools.rome.feed.rss.*; +import com.rometools.rome.feed.rss.Category; +import com.rometools.rome.feed.rss.Channel; +import com.rometools.rome.feed.rss.Description; +import com.rometools.rome.feed.rss.Guid; +import com.rometools.rome.feed.rss.Image; +import com.rometools.rome.feed.rss.Item; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -134,7 +140,10 @@ public class MessagesView extends AbstractRssFeedView { String messageDescription = isCode ? MessageUtils.formatMessageCode(StringUtils.defaultString(msg.getText())) : MessageUtils.formatMessage(StringUtils.defaultString(msg.getText())); item.setLink(messageUrl); - // item.setGuid(messageUrl); + Guid guid = new Guid(); + guid.setPermaLink(true); + guid.setValue(messageUrl); + item.setGuid(guid); item.setTitle(messageTitle); Description description = new Description(); description.setType("text/html"); diff --git a/src/main/java/com/juick/www/rss/RepliesView.java b/src/main/java/com/juick/www/rss/RepliesView.java index 98e6db1d..9cb98c94 100644 --- a/src/main/java/com/juick/www/rss/RepliesView.java +++ b/src/main/java/com/juick/www/rss/RepliesView.java @@ -28,6 +28,7 @@ import com.rometools.modules.mediarss.types.Thumbnail; import com.rometools.modules.mediarss.types.UrlReference; import com.rometools.rome.feed.rss.Channel; import com.rometools.rome.feed.rss.Description; +import com.rometools.rome.feed.rss.Guid; import com.rometools.rome.feed.rss.Item; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -80,7 +81,10 @@ public class RepliesView extends AbstractRssFeedView { String messageTitle = String.format("@%s:", msg.getUname()); String messageDescription = msg.isHtml() ? msg.getDescription() : MessageUtils.formatMessage(msg.getDescription()); item.setLink(messageUrl); - //item.setGuid(messageUrl); + Guid guid = new Guid(); + guid.setPermaLink(true); + guid.setValue(messageUrl); + item.setGuid(guid); item.setTitle(messageTitle); Description description = new Description(); description.setType("text/html"); -- cgit v1.2.3