Commit c0e5334e0811d15dbcbc0b86a35ba498c3e9640d
Do not display 'show <n> updates' message for messages patchwork cannot render.
Gordon Martin committed on 10/14/2017, 11:17:12 PMParent: 77eedb8c00b849b6938a5209d63860dabd04b2f6
Files changed
modules/feed/html/rollup.js | changed |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -95,10 +95,14 @@ | ||
95 | 95 | }), |
96 | 96 | pull.drain((msg) => { |
97 | 97 | if (msg.value.content.type === 'vote') return |
98 | 98 | if (api.app.sync.externalHandler(msg)) return |
99 | - newSinceRefresh.add(msg.key) | |
100 | 99 | |
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 | + | |
101 | 105 | if (updates() === 0 && msg.value.author === yourId && container.scrollTop < 20) { |
102 | 106 | refresh() |
103 | 107 | } else { |
104 | 108 | updates.set(newSinceRefresh.size) |
@@ -116,8 +120,22 @@ | ||
116 | 120 | result.reload = refresh |
117 | 121 | |
118 | 122 | return result |
119 | 123 | |
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 | + | |
120 | 138 | function refresh () { |
121 | 139 | onceTrue(waitFor, () => { |
122 | 140 | if (abortLastFeed) abortLastFeed() |
123 | 141 | updates.set(0) |
Built with git-ssb-web