git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit c0e5334e0811d15dbcbc0b86a35ba498c3e9640d

Do not display 'show <n> updates' message for messages patchwork cannot render.

Gordon Martin committed on 10/14/2017, 11:17:12 PM
Parent: 77eedb8c00b849b6938a5209d63860dabd04b2f6

Files changed

modules/feed/html/rollup.jschanged
modules/feed/html/rollup.jsView
@@ -95,10 +95,14 @@
9595 }),
9696 pull.drain((msg) => {
9797 if (msg.value.content.type === 'vote') return
9898 if (api.app.sync.externalHandler(msg)) return
99- newSinceRefresh.add(msg.key)
10099
100+ // Only increment the 'new since' for items that we render on
101+ // the feed as otherwise the 'show <n> updates message' will be
102+ // shown on new messages that patchwork cannot render
103+ if (canRenderMessage(msg)) newSinceRefresh.add(msg.key)
104+
101105 if (updates() === 0 && msg.value.author === yourId && container.scrollTop < 20) {
102106 refresh()
103107 } else {
104108 updates.set(newSinceRefresh.size)
@@ -116,8 +120,22 @@
116120 result.reload = refresh
117121
118122 return result
119123
124+ function canRenderMessage(msg) {
125+
126+ // TODO: This implementation of 'canRenderMessage' is just for a proof of
127+ // concept. I will add an alternative that just returns 'true' rather
128+ // than rendering if the provider handles the message type
129+
130+ var isRenderableByPatchbay = api.message.html.render(msg, {
131+ inContext: true,
132+ priority: highlightItems.has(msg.key) ? 2 : 0
133+ });
134+
135+ return isRenderableByPatchbay;
136+ }
137+
120138 function refresh () {
121139 onceTrue(waitFor, () => {
122140 if (abortLastFeed) abortLastFeed()
123141 updates.set(0)

Built with git-ssb-web