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 AMParent: 9216a0ee5a7da1602222d794ef538ca059e1face
Files changed
modules/feed-summary.js | changed |
modules/message.js | changed |
modules/thread.js | changed |
modules/feed-summary.js | ||
---|---|---|
@@ -138,15 +138,15 @@ | ||
138 | 138 | |
139 | 139 | function renderItem (item) { |
140 | 140 | if (item.type === 'message') { |
141 | 141 | var meta = null |
142 | - var lastId = item.messageId | |
142 | + var previousId = item.messageId | |
143 | 143 | 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 | |
146 | 146 | return result |
147 | 147 | }) |
148 | - var renderedMessage = item.message ? message_render(item.message, true) : null | |
148 | + var renderedMessage = item.message ? message_render(item.message, {inContext: true}) : null | |
149 | 149 | if (renderedMessage) { |
150 | 150 | if (item.lastUpdateType === 'reply' && item.repliesFrom.size) { |
151 | 151 | meta = m('div.meta', { |
152 | 152 | title: people_names(item.repliesFrom) |
modules/message.js | ||
---|---|---|
@@ -26,11 +26,17 @@ | ||
26 | 26 | ]) |
27 | 27 | return div |
28 | 28 | } |
29 | 29 | |
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 | + | |
31 | 35 | var elMini = message_content_mini(msg) |
32 | - if (elMini) { | |
36 | + var el = message_content(msg) | |
37 | + | |
38 | + if (elMini && (!el || inSummary)) { | |
33 | 39 | var div = h('Message', { |
34 | 40 | 'ev-contextmenu': contextMenu.bind(null, msg) |
35 | 41 | }, [ |
36 | 42 | h('header', [ |
@@ -44,9 +50,8 @@ | ||
44 | 50 | div.setAttribute('tabindex', '0') |
45 | 51 | return div |
46 | 52 | } |
47 | 53 | |
48 | - var el = message_content(msg) | |
49 | 54 | if (!el) return |
50 | 55 | |
51 | 56 | var classList = [] |
52 | 57 | var replyInfo = null |
modules/thread.js | ||
---|---|---|
@@ -60,9 +60,9 @@ | ||
60 | 60 | root: id, |
61 | 61 | branch: id //mutated when thread is loaded. |
62 | 62 | } |
63 | 63 | |
64 | - var lastId = id | |
64 | + var previousId = id | |
65 | 65 | var content = h('div.column.scroller__content') |
66 | 66 | var div = h('div.column.scroller', |
67 | 67 | {style: {'overflow-y': 'auto'}}, |
68 | 68 | h('div.scroller__wrapper', |
@@ -97,10 +97,10 @@ | ||
97 | 97 | }) |
98 | 98 | |
99 | 99 | if(err) return content.appendChild(h('pre', err.stack)) |
100 | 100 | 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 | |
103 | 103 | return result |
104 | 104 | }).filter(Boolean).forEach(function (el) { |
105 | 105 | content.appendChild(el) |
106 | 106 | }) |
Built with git-ssb-web