modules/feed/html/rollup.jsView |
---|
3 | 3 | var computed = require('mutant/computed') |
4 | 4 | var h = require('mutant/h') |
5 | 5 | var MutantArray = require('mutant/array') |
6 | 6 | var Abortable = require('pull-abortable') |
| 7 | +var map = require('mutant/map') |
7 | 8 | var pull = require('pull-stream') |
8 | 9 | var nest = require('depnest') |
9 | 10 | |
10 | 11 | var onceTrue = require('mutant/once-true') |
16 | 17 | link: 'first' |
17 | 18 | }, |
18 | 19 | 'sbot.async.get': 'first', |
19 | 20 | 'keys.sync.id': 'first', |
| 21 | + 'about.obs.name': 'first', |
20 | 22 | feed: { |
21 | 23 | 'html.rollup': 'first', |
22 | 24 | 'pull.summary': 'first' |
23 | 25 | }, |
24 | 26 | profile: { |
25 | 27 | 'html.person': 'first', |
26 | | - 'html.manyPeople': 'first', |
27 | | - 'obs.names': 'first' |
| 28 | + 'html.manyPeople': 'first' |
28 | 29 | } |
29 | 30 | }) |
30 | 31 | |
31 | 32 | exports.gives = nest({ |
176 | 177 | var renderedMessage = item.message ? api.message.html.render(item.message, {inContext: true}) : null |
177 | 178 | if (renderedMessage) { |
178 | 179 | if (item.lastUpdateType === 'reply' && item.repliesFrom.size) { |
179 | 180 | meta = h('div.meta', { |
180 | | - title: api.profile.obs.names(item.repliesFrom) |
| 181 | + title: names(item.repliesFrom) |
181 | 182 | }, [ |
182 | 183 | api.profile.html.manyPeople(item.repliesFrom), ' replied' |
183 | 184 | ]) |
184 | 185 | } else if (item.lastUpdateType === 'dig' && item.digs.size) { |
185 | 186 | meta = h('div.meta', { |
186 | | - title: api.profile.obs.names(item.digs) |
| 187 | + title: names(item.digs) |
187 | 188 | }, [ |
188 | 189 | api.profile.html.manyPeople(item.digs), ' dug this message' |
189 | 190 | ]) |
190 | 191 | } |
201 | 202 | ]) |
202 | 203 | } else { |
203 | 204 | if (item.lastUpdateType === 'reply' && item.repliesFrom.size) { |
204 | 205 | meta = h('div.meta', { |
205 | | - title: api.profile.obs.names(item.repliesFrom) |
| 206 | + title: names(item.repliesFrom) |
206 | 207 | }, [ |
207 | 208 | api.profile.html.manyPeople(item.repliesFrom), ' replied to ', api.message.html.link(item.messageId) |
208 | 209 | ]) |
209 | 210 | } else if (item.lastUpdateType === 'dig' && item.digs.size) { |
210 | 211 | meta = h('div.meta', { |
211 | | - title: api.profile.obs.names(item.digs) |
| 212 | + title: names(item.digs) |
212 | 213 | }, [ |
213 | 214 | api.profile.html.manyPeople(item.digs), ' dug ', api.message.html.link(item.messageId) |
214 | 215 | ]) |
215 | 216 | } |
222 | 223 | } |
223 | 224 | } else if (item.type === 'follow') { |
224 | 225 | return h('div', {className: 'FeedEvent -follow'}, [ |
225 | 226 | h('div.meta', { |
226 | | - title: api.profile.obs.names(item.contacts) |
| 227 | + title: names(item.contacts) |
227 | 228 | }, [ |
228 | 229 | api.profile.html.person(item.id), ' followed ', api.profile.html.manyPeople(item.contacts) |
229 | 230 | ]) |
230 | 231 | ]) |
231 | 232 | } |
232 | 233 | |
233 | 234 | return h('div') |
234 | 235 | } |
| 236 | + |
| 237 | + function names (ids) { |
| 238 | + var items = map(ids, api.about.obs.name) |
| 239 | + return computed([items], (names) => names.map((n) => `- ${n}`).join('\n')) |
| 240 | + } |
235 | 241 | } |