git ssb

10+

Matt McKegg / patchwork



Commit 13043b66c007b7b9381f9c550aa436fee2fe490f

correctly track reply authors of most recent and root post

Matt McKegg committed on 2/25/2018, 6:19:02 AM
Parent: 7381a35f2932b9f7bc20367318557ecf1a3530d0

Files changed

modules/page/html/render/message.jschanged
modules/page/html/render/message.jsView
@@ -32,9 +32,9 @@
3232 var meta = Struct({
3333 type: 'post',
3434 root: Proxy(id),
3535 branch: Proxy(id),
36- reply: Value(undefined),
36+ reply: Proxy(undefined),
3737 channel: Value(undefined),
3838 recps: Value(undefined)
3939 })
4040
@@ -77,10 +77,24 @@
7777 meta.channel.set(value.content.channel)
7878 meta.root.set(root || thread.rootId)
7979
8080 // track message author for resolving missing messages and reply mentions
81- meta.reply.set({[id]: author})
81+ meta.reply.set(computed(thread.messages, messages => {
82+ var result = {}
83+ var first = messages[0]
84+ var last = messages[messages.length - 1]
8285
86+ if (first && first.value) {
87+ result[messages[0].key] = messages[0].value.author
88+ }
89+
90+ if (last && last !== first && last.value) {
91+ result[last.key] = last.value.author
92+ }
93+
94+ return result
95+ }))
96+
8397 // if root thread, reply to last post
8498 meta.branch.set(isReply ? thread.branchId : thread.lastId)
8599
86100 participants.set(computed(thread.messages, messages => {

Built with git-ssb-web