git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit 1b3cd033a1bcbce8ab33456c2f553c44c385aa85

jump to first reply rather than most recent when "view full thread"

fixes #650
Matt McKegg committed on 10/15/2017, 11:06:39 PM
Parent: 3de76e5250e20ec4d674bf704a41ddd543917644

Files changed

modules/feed/html/rollup.jschanged
modules/feed/html/rollup.jsView
@@ -170,10 +170,10 @@
170170 lastBumpType = type
171171 }
172172 })
173173
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) => {
176176 var result = api.message.html.render(msg, {
177177 inContext: true,
178178 inSummary: true,
179179 previousId,
@@ -208,22 +208,16 @@
208208 meta,
209209 renderedMessage,
210210 when(replyElements.length, [
211211 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, ')'])
213213 ),
214214 h('div.replies', replyElements)
215215 ])
216216 ])
217217 }
218218 })
219219
220- function getFirstId (elements) {
221- if (Array.isArray(elements) && elements.length) {
222- return elements[0].dataset.id
223- }
224- }
225-
226220 function names (ids) {
227221 var items = map(Array.from(ids), api.about.obs.name)
228222 return computed([items], (names) => names.map((n) => `- ${n}`).join('\n'))
229223 }

Built with git-ssb-web