git ssb

10+

Matt McKegg / patchwork



Commit 452d3838ab4f6ffb18b71fff39793437a4d88c4e

scroll to start of highlighted messages when viewing full thread

Matt McKegg committed on 11/20/2017, 3:32:21 AM
Parent: 217c274425bfc6f97a221190b58a329730ab0482

Files changed

modules/feed/html/rollup.jschanged
modules/feed/html/rollup.jsView
@@ -192,8 +192,9 @@
192192 }
193193 })
194194
195195 var replies = item.replies.filter(isReply).sort(byAssertedTime)
196+ var highlightedReplies = replies.filter(isHighlighted)
196197 var replyElements = replies.filter(displayFilter).slice(-3).map((msg) => {
197198 var result = api.message.html.render(msg, {
198199 previousId,
199200 compact: compactFilter(msg, item),
@@ -224,21 +225,28 @@
224225 many(bumps, api.profile.html.person, i18n), ' ', description
225226 ])
226227 }
227228
229+ // if there are new messages, view full thread goes to the top of those, otherwise to very first reply
230+ var anchorReply = highlightedReplies.length >= 3 ? highlightedReplies[0] : replies[0]
231+
228232 return h('FeedEvent -post', {
229233 attributes: {
230234 'data-root-id': item.key
231235 }
232236 }, [
233237 meta,
234238 renderedMessage,
235239 when(replies.length > replyElements.length || partial,
236- h('a.full', {href: item.key, anchor: replies[0] && replies[0].key}, [i18n('View full thread') + ' (', replies.length, ')'])
240+ h('a.full', {href: item.key, anchor: anchorReply && anchorReply.key}, [i18n('View full thread') + ' (', replies.length, ')'])
237241 ),
238242 h('div.replies', replyElements)
239243 ])
240244 }
245+
246+ function isHighlighted (msg) {
247+ return highlightItems.has(msg.key)
248+ }
241249 })
242250
243251 function LookupRoot () {
244252 return paramap((msg, cb) => {

Built with git-ssb-web