git ssb

10+

Matt McKegg / patchwork



Commit fbe32d268a26202c637c4452de4b6a47fcc7bb81

only show mini posts in summary, viewing push directly should show full message

Matt McKegg committed on 11/4/2016, 3:58:42 AM
Parent: 9216a0ee5a7da1602222d794ef538ca059e1face

Files changed

modules/feed-summary.jschanged
modules/message.jschanged
modules/thread.jschanged
modules/feed-summary.jsView
@@ -138,15 +138,15 @@
138138
139139 function renderItem (item) {
140140 if (item.type === 'message') {
141141 var meta = null
142- var lastId = item.messageId
142 + var previousId = item.messageId
143143 var replies = item.replies.slice(-4).map((msg) => {
144- var result = message_render(msg, true, lastId)
145- lastId = msg.key
144 + var result = message_render(msg, {inContext: true, inSummary: true, previousId})
145 + previousId = msg.key
146146 return result
147147 })
148- var renderedMessage = item.message ? message_render(item.message, true) : null
148 + var renderedMessage = item.message ? message_render(item.message, {inContext: true}) : null
149149 if (renderedMessage) {
150150 if (item.lastUpdateType === 'reply' && item.repliesFrom.size) {
151151 meta = m('div.meta', {
152152 title: people_names(item.repliesFrom)
modules/message.jsView
@@ -26,11 +26,17 @@
2626 ])
2727 return div
2828 }
2929
30-exports.message_render = function (msg, inContext, previousId) {
30 +exports.message_render = function (msg, opts) {
31 + var inContext = opts.inContext
32 + var previousId = opts.previousId
33 + var inSummary = opts.inSummary
34 +
3135 var elMini = message_content_mini(msg)
32- if (elMini) {
36 + var el = message_content(msg)
37 +
38 + if (elMini && (!el || inSummary)) {
3339 var div = h('Message', {
3440 'ev-contextmenu': contextMenu.bind(null, msg)
3541 }, [
3642 h('header', [
@@ -44,9 +50,8 @@
4450 div.setAttribute('tabindex', '0')
4551 return div
4652 }
4753
48- var el = message_content(msg)
4954 if (!el) return
5055
5156 var classList = []
5257 var replyInfo = null
modules/thread.jsView
@@ -60,9 +60,9 @@
6060 root: id,
6161 branch: id //mutated when thread is loaded.
6262 }
6363
64- var lastId = id
64 + var previousId = id
6565 var content = h('div.column.scroller__content')
6666 var div = h('div.column.scroller',
6767 {style: {'overflow-y': 'auto'}},
6868 h('div.scroller__wrapper',
@@ -97,10 +97,10 @@
9797 })
9898
9999 if(err) return content.appendChild(h('pre', err.stack))
100100 sort(thread).map((msg) => {
101- var result = message_render(msg, true, lastId)
102- lastId = msg.key
101 + var result = message_render(msg, {inContext: true, previousId})
102 + previousId = msg.key
103103 return result
104104 }).filter(Boolean).forEach(function (el) {
105105 content.appendChild(el)
106106 })

Built with git-ssb-web