Commit 13a789cf8e2385a1b61b16eda538aa00a5056d5f
fix following message not showing after refresh
fix #660Matt McKegg committed on 10/28/2017, 1:11:29 PM
Parent: 7f0e32707cd24ca1c8721a7b8a6028e13958630e
Files changed
modules/page/html/render/public.js | changed |
modules/page/html/render/public.js | ||
---|---|---|
@@ -57,19 +57,23 @@ | ||
57 | 57 | var prepend = [ |
58 | 58 | api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') }) |
59 | 59 | ] |
60 | 60 | |
61 | + var lastMessage = null | |
62 | + | |
61 | 63 | var getStream = (opts) => { |
64 | + if (!opts.lt) { | |
65 | + // HACK: reset the isReplacementMessage check | |
66 | + lastMessage = null | |
67 | + } | |
62 | 68 | if (opts.lt != null && !opts.lt.marker) { |
63 | 69 | // if an lt has been specified that is not a marker, assume stream is finished |
64 | 70 | return pull.empty() |
65 | 71 | } else { |
66 | 72 | return api.sbot.pull.stream(sbot => sbot.patchwork.roots(extend(opts, { ids: [id] }))) |
67 | 73 | } |
68 | 74 | } |
69 | 75 | |
70 | - var lastMessage = null | |
71 | - | |
72 | 76 | var filters = api.settings.obs.get('filters') |
73 | 77 | var feedView = api.feed.html.rollup(getStream, { |
74 | 78 | prepend, |
75 | 79 | prefiltered: true, // we've already filtered out the roots we don't want to include |
@@ -91,8 +95,9 @@ | ||
91 | 95 | rootFilter: function (msg) { |
92 | 96 | var filtered = filters() && filters().following && getType(msg) === 'contact' |
93 | 97 | // skip messages that are directly replaced by the previous message |
94 | 98 | // e.g. follow / unfollow in quick succession |
99 | + // THIS IS A TOTAL HACK!!! SHOULD BE REPLACED WITH A PROPER ROLLUP! | |
95 | 100 | var isOutdated = isReplacementMessage(msg, lastMessage) |
96 | 101 | if (!filtered && !isOutdated) { |
97 | 102 | lastMessage = msg |
98 | 103 | return true |
@@ -114,9 +119,11 @@ | ||
114 | 119 | h('div.main', feedView) |
115 | 120 | ]) |
116 | 121 | |
117 | 122 | result.pendingUpdates = feedView.pendingUpdates |
118 | - result.reload = feedView.reload | |
123 | + result.reload = function () { | |
124 | + feedView.reload() | |
125 | + } | |
119 | 126 | |
120 | 127 | return result |
121 | 128 | |
122 | 129 | function checkTag (mentions) { |
@@ -246,8 +253,9 @@ | ||
246 | 253 | } |
247 | 254 | |
248 | 255 | function isReplacementMessage (msgA, msgB) { |
249 | 256 | if (msgA && msgB && msgA.value.content && msgB.value.content && msgA.value.content.type === msgB.value.content.type) { |
257 | + if (msgA.key === msgB.key) return false | |
250 | 258 | var type = msgA.value.content.type |
251 | 259 | if (type === 'contact') { |
252 | 260 | return msgA.value.author === msgB.value.author && msgA.value.content.contact === msgB.value.content.contact |
253 | 261 | } |
Built with git-ssb-web