Commit b8dcb5e1ae317132d4e8498b59e5279fcf92490f
alternate missing message tracking (handle branch better)
Matt McKegg committed on 11/4/2017, 11:31:34 PMParent: 8b4e456e87cad1c31bf2022137e937fe3a47c2ad
Files changed
modules/message/html/missing.js | changed |
modules/page/html/render/message.js | changed |
modules/message/html/missing.js | ||
---|---|---|
@@ -29,9 +29,9 @@ | ||
29 | 29 | return result |
30 | 30 | }) |
31 | 31 | |
32 | 32 | function messageMissing (id, hintMessage) { |
33 | - var possibleAuthor = only(hintMessage.value.content.reply) | |
33 | + var possibleAuthor = hintMessage.value.content.reply && hintMessage.value.content.reply[id] | |
34 | 34 | var msg = { |
35 | 35 | key: id, |
36 | 36 | value: { |
37 | 37 | missing: true, |
@@ -63,12 +63,4 @@ | ||
63 | 63 | element.msg = msg |
64 | 64 | return element |
65 | 65 | } |
66 | 66 | } |
67 | - | |
68 | -function only (arrayOrString) { | |
69 | - if (Array.isArray(arrayOrString) && arrayOrString.length === 1) { | |
70 | - return arrayOrString[0] | |
71 | - } else if (typeof arrayOrString === 'string') { | |
72 | - return arrayOrString | |
73 | - } | |
74 | -} |
modules/page/html/render/message.js | ||
---|---|---|
@@ -74,8 +74,11 @@ | ||
74 | 74 | |
75 | 75 | meta.channel.set(value.content.channel) |
76 | 76 | meta.root.set(root || thread.rootId) |
77 | 77 | |
78 | + // track message author for resolving missing messages and reply mentions | |
79 | + meta.reply.set({[id]: author}) | |
80 | + | |
78 | 81 | // if root thread, reply to last post |
79 | 82 | meta.branch.set(isReply ? thread.branchId : thread.lastId) |
80 | 83 | |
81 | 84 | var container = h('Thread', [ |
@@ -103,15 +106,8 @@ | ||
103 | 106 | compose |
104 | 107 | ]) |
105 | 108 | result.set(when(thread.sync, container, loader)) |
106 | 109 | |
107 | - watch(anchor, (anchor) => { | |
108 | - if (anchor === 'reply') { | |
109 | - meta.reply.set([author]) | |
110 | - } else { | |
111 | - meta.reply.set(undefined) | |
112 | - } | |
113 | - }) | |
114 | 110 | }) |
115 | 111 | |
116 | 112 | var view = h('div', {className: 'SplitView'}, [ |
117 | 113 | h('div.main', [ |
Built with git-ssb-web