diff --git a/briar-headless/src/main/java/org/briarproject/briar/headless/blogs/OutputBlogPost.kt b/briar-headless/src/main/java/org/briarproject/briar/headless/blogs/OutputBlogPost.kt index b744c9401..de63de714 100644 --- a/briar-headless/src/main/java/org/briarproject/briar/headless/blogs/OutputBlogPost.kt +++ b/briar-headless/src/main/java/org/briarproject/briar/headless/blogs/OutputBlogPost.kt @@ -1,20 +1,25 @@ package org.briarproject.briar.headless.blogs +import org.briarproject.bramble.api.sync.MessageId import org.briarproject.bramble.identity.output import org.briarproject.briar.api.blog.BlogPostHeader import org.briarproject.briar.api.blog.MessageType +import org.briarproject.briar.headless.json.JsonDict -internal fun BlogPostHeader.output(body: String) = mapOf( - "body" to body, - "author" to author.output(), - "authorStatus" to authorStatus.output(), - "type" to type.output(), - "id" to id.bytes, - "parentId" to parentId?.bytes, - "read" to isRead, - "rssFeed" to isRssFeed, - "timestamp" to timestamp, - "timestampReceived" to timeReceived -) +internal fun BlogPostHeader.output(body: String): JsonDict { + val dict = JsonDict( + "body" to body, + "author" to author.output(), + "authorStatus" to authorStatus.output(), + "type" to type.output(), + "id" to id.bytes, + "read" to isRead, + "rssFeed" to isRssFeed, + "timestamp" to timestamp, + "timestampReceived" to timeReceived + ) + if (parentId != null) dict.put("parentId", (parentId as MessageId).bytes) + return dict +} internal fun MessageType.output() = name.toLowerCase()