git ssb

10+

Matt McKegg / patchwork



Commit 13a789cf8e2385a1b61b16eda538aa00a5056d5f

fix following message not showing after refresh

fix #660
Matt McKegg committed on 10/28/2017, 1:11:29 PM
Parent: 7f0e32707cd24ca1c8721a7b8a6028e13958630e

Files changed

modules/page/html/render/public.jschanged
modules/page/html/render/public.jsView
@@ -57,19 +57,23 @@
5757 var prepend = [
5858 api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') })
5959 ]
6060
61+ var lastMessage = null
62+
6163 var getStream = (opts) => {
64+ if (!opts.lt) {
65+ // HACK: reset the isReplacementMessage check
66+ lastMessage = null
67+ }
6268 if (opts.lt != null && !opts.lt.marker) {
6369 // if an lt has been specified that is not a marker, assume stream is finished
6470 return pull.empty()
6571 } else {
6672 return api.sbot.pull.stream(sbot => sbot.patchwork.roots(extend(opts, { ids: [id] })))
6773 }
6874 }
6975
70- var lastMessage = null
71-
7276 var filters = api.settings.obs.get('filters')
7377 var feedView = api.feed.html.rollup(getStream, {
7478 prepend,
7579 prefiltered: true, // we've already filtered out the roots we don't want to include
@@ -91,8 +95,9 @@
9195 rootFilter: function (msg) {
9296 var filtered = filters() && filters().following && getType(msg) === 'contact'
9397 // skip messages that are directly replaced by the previous message
9498 // e.g. follow / unfollow in quick succession
99+ // THIS IS A TOTAL HACK!!! SHOULD BE REPLACED WITH A PROPER ROLLUP!
95100 var isOutdated = isReplacementMessage(msg, lastMessage)
96101 if (!filtered && !isOutdated) {
97102 lastMessage = msg
98103 return true
@@ -114,9 +119,11 @@
114119 h('div.main', feedView)
115120 ])
116121
117122 result.pendingUpdates = feedView.pendingUpdates
118- result.reload = feedView.reload
123+ result.reload = function () {
124+ feedView.reload()
125+ }
119126
120127 return result
121128
122129 function checkTag (mentions) {
@@ -246,8 +253,9 @@
246253 }
247254
248255 function isReplacementMessage (msgA, msgB) {
249256 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
250258 var type = msgA.value.content.type
251259 if (type === 'contact') {
252260 return msgA.value.author === msgB.value.author && msgA.value.content.contact === msgB.value.content.contact
253261 }

Built with git-ssb-web