Commit 13043b66c007b7b9381f9c550aa436fee2fe490f
correctly track reply authors of most recent and root post
Matt McKegg committed on 2/25/2018, 6:19:02 AMParent: 7381a35f2932b9f7bc20367318557ecf1a3530d0
Files changed
modules/page/html/render/message.js | changed |
modules/page/html/render/message.js | ||
---|---|---|
@@ -32,9 +32,9 @@ | ||
32 | 32 | var meta = Struct({ |
33 | 33 | type: 'post', |
34 | 34 | root: Proxy(id), |
35 | 35 | branch: Proxy(id), |
36 | - reply: Value(undefined), | |
36 | + reply: Proxy(undefined), | |
37 | 37 | channel: Value(undefined), |
38 | 38 | recps: Value(undefined) |
39 | 39 | }) |
40 | 40 | |
@@ -77,10 +77,24 @@ | ||
77 | 77 | meta.channel.set(value.content.channel) |
78 | 78 | meta.root.set(root || thread.rootId) |
79 | 79 | |
80 | 80 | // 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] | |
82 | 85 | |
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 | + | |
83 | 97 | // if root thread, reply to last post |
84 | 98 | meta.branch.set(isReply ? thread.branchId : thread.lastId) |
85 | 99 | |
86 | 100 | participants.set(computed(thread.messages, messages => { |
Built with git-ssb-web