Show blog posts from RSS feeds with a dedicated icon

This adds a field to the post headers and some more tests.
This commit is contained in:
Torsten Grote
2017-04-11 11:31:14 -03:00
parent 0256ec0b8c
commit 9bfb58a764
12 changed files with 164 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ public class BlogCommentHeader extends BlogPostHeader {
Status authorStatus, boolean read) {
super(type, groupId, id, parent.getId(), timestamp,
timeReceived, author, authorStatus, read);
timeReceived, author, authorStatus, false, read);
if (type != COMMENT && type != WRAPPED_COMMENT)
throw new IllegalArgumentException("Incompatible Message Type");
@@ -41,6 +41,9 @@ public class BlogCommentHeader extends BlogPostHeader {
}
public BlogPostHeader getParent() {
if (parent instanceof BlogCommentHeader)
return ((BlogCommentHeader) parent).getParent();
return parent;
}
}

View File

@@ -28,6 +28,7 @@ public interface BlogConstants {
String KEY_AUTHOR_NAME = "name";
String KEY_PUBLIC_KEY = "publicKey";
String KEY_AUTHOR = "author";
String KEY_RSS_FEED = "rssFeed";
String KEY_READ = "read";
String KEY_COMMENT = "comment";
String KEY_ORIGINAL_MSG_ID = "originalMessageId";

View File

@@ -17,21 +17,23 @@ public class BlogPostHeader extends PostHeader {
private final MessageType type;
private final GroupId groupId;
private final long timeReceived;
private final boolean rssFeed;
public BlogPostHeader(MessageType type, GroupId groupId, MessageId id,
@Nullable MessageId parentId, long timestamp, long timeReceived,
Author author, Status authorStatus, boolean read) {
Author author, Status authorStatus, boolean rssFeed, boolean read) {
super(id, parentId, timestamp, author, authorStatus, read);
this.type = type;
this.groupId = groupId;
this.timeReceived = timeReceived;
this.rssFeed = rssFeed;
}
public BlogPostHeader(MessageType type, GroupId groupId, MessageId id,
long timestamp, long timeReceived, Author author,
Status authorStatus, boolean read) {
Status authorStatus, boolean rssFeed, boolean read) {
this(type, groupId, id, null, timestamp, timeReceived, author,
authorStatus, read);
authorStatus, rssFeed, read);
}
public MessageType getType() {
@@ -45,4 +47,9 @@ public class BlogPostHeader extends PostHeader {
public long getTimeReceived() {
return timeReceived;
}
public boolean isRssFeed() {
return rssFeed;
}
}