Add post sub-type to post renderer
This commit is contained in:
parent
e596f17a9e
commit
03a894b133
|
@ -99,7 +99,7 @@ const transform = (ssb, messages, myFeedId) =>
|
|||
// [ @key, @key, @key ]
|
||||
const voters = Object
|
||||
.entries(reducedVotes)
|
||||
.filter(([key, value]) => value === 1)
|
||||
.filter(([, value]) => value === 1)
|
||||
.map(([key]) => key)
|
||||
|
||||
const pendingName = cooler.get(
|
||||
|
@ -149,6 +149,16 @@ const transform = (ssb, messages, myFeedId) =>
|
|||
url: avatarUrl
|
||||
})
|
||||
|
||||
if (isRoot(msg)) {
|
||||
lodash.set(msg, 'value.meta.postType', 'posted')
|
||||
} else if (isReply(msg)) {
|
||||
lodash.set(msg, 'value.meta.postType', 'replied to thread')
|
||||
} else if (isNestedReply(msg)) {
|
||||
lodash.set(msg, 'value.meta.postType', 'replied to message')
|
||||
} else {
|
||||
lodash.set(msg, 'value.meta.postType', 'published a mysterious message')
|
||||
}
|
||||
|
||||
lodash.set(msg, 'value.meta.votes', voters)
|
||||
lodash.set(msg, 'value.meta.voted', voters.includes(myFeedId))
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
const {
|
||||
a,
|
||||
abbr,
|
||||
article,
|
||||
button,
|
||||
details,
|
||||
|
@ -112,8 +111,11 @@ module.exports = ({ msg }) => {
|
|||
span({ class: 'text' },
|
||||
span({ class: 'author' },
|
||||
a({ href: url.author }, name)),
|
||||
span({ class: 'timestamp' }, ` ${timeAgo} ago`),
|
||||
isPrivate ? abbr({ title: 'private' }, '🔒') : null)),
|
||||
isPrivate ? ' privately 🔒' : null,
|
||||
span(` ${msg.value.meta.postType}`),
|
||||
span(` ${timeAgo} ago`),
|
||||
':'
|
||||
)),
|
||||
articleContent,
|
||||
|
||||
// HACK: centered-footer
|
||||
|
|
Loading…
Reference in New Issue