Commit 1b3cd033a1bcbce8ab33456c2f553c44c385aa85
jump to first reply rather than most recent when "view full thread"
fixes #650Matt McKegg committed on 10/15/2017, 11:06:39 PM
Parent: 3de76e5250e20ec4d674bf704a41ddd543917644
Files changed
modules/feed/html/rollup.js | changed |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -170,10 +170,10 @@ | ||
170 | 170 | lastBumpType = type |
171 | 171 | } |
172 | 172 | }) |
173 | 173 | |
174 | - var replies = item.replies.filter(isReply) | |
175 | - var replyElements = replies.filter(displayFilter).sort(byAssertedTime).slice(-3).map((msg) => { | |
174 | + var replies = item.replies.filter(isReply).filter(displayFilter).sort(byAssertedTime) | |
175 | + var replyElements = replies.slice(-3).map((msg) => { | |
176 | 176 | var result = api.message.html.render(msg, { |
177 | 177 | inContext: true, |
178 | 178 | inSummary: true, |
179 | 179 | previousId, |
@@ -208,22 +208,16 @@ | ||
208 | 208 | meta, |
209 | 209 | renderedMessage, |
210 | 210 | when(replyElements.length, [ |
211 | 211 | when(replies.length > replyElements.length || partial, |
212 | - h('a.full', {href: item.key, anchor: getFirstId(replyElements)}, [i18n('View full thread') + ' (', replies.length, ')']) | |
212 | + h('a.full', {href: item.key, anchor: replies[0] && replies[0].key}, [i18n('View full thread') + ' (', replies.length, ')']) | |
213 | 213 | ), |
214 | 214 | h('div.replies', replyElements) |
215 | 215 | ]) |
216 | 216 | ]) |
217 | 217 | } |
218 | 218 | }) |
219 | 219 | |
220 | - function getFirstId (elements) { | |
221 | - if (Array.isArray(elements) && elements.length) { | |
222 | - return elements[0].dataset.id | |
223 | - } | |
224 | - } | |
225 | - | |
226 | 220 | function names (ids) { |
227 | 221 | var items = map(Array.from(ids), api.about.obs.name) |
228 | 222 | return computed([items], (names) => names.map((n) => `- ${n}`).join('\n')) |
229 | 223 | } |
Built with git-ssb-web