git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit b8dcb5e1ae317132d4e8498b59e5279fcf92490f

alternate missing message tracking (handle branch better)

Matt McKegg committed on 11/4/2017, 11:31:34 PM
Parent: 8b4e456e87cad1c31bf2022137e937fe3a47c2ad

Files changed

modules/message/html/missing.jschanged
modules/page/html/render/message.jschanged
modules/message/html/missing.jsView
@@ -29,9 +29,9 @@
2929 return result
3030 })
3131
3232 function messageMissing (id, hintMessage) {
33- var possibleAuthor = only(hintMessage.value.content.reply)
33+ var possibleAuthor = hintMessage.value.content.reply && hintMessage.value.content.reply[id]
3434 var msg = {
3535 key: id,
3636 value: {
3737 missing: true,
@@ -63,12 +63,4 @@
6363 element.msg = msg
6464 return element
6565 }
6666 }
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.jsView
@@ -74,8 +74,11 @@
7474
7575 meta.channel.set(value.content.channel)
7676 meta.root.set(root || thread.rootId)
7777
78+ // track message author for resolving missing messages and reply mentions
79+ meta.reply.set({[id]: author})
80+
7881 // if root thread, reply to last post
7982 meta.branch.set(isReply ? thread.branchId : thread.lastId)
8083
8184 var container = h('Thread', [
@@ -103,15 +106,8 @@
103106 compose
104107 ])
105108 result.set(when(thread.sync, container, loader))
106109
107- watch(anchor, (anchor) => {
108- if (anchor === 'reply') {
109- meta.reply.set([author])
110- } else {
111- meta.reply.set(undefined)
112- }
113- })
114110 })
115111
116112 var view = h('div', {className: 'SplitView'}, [
117113 h('div.main', [

Built with git-ssb-web