git ssb

2+

mixmix / ticktack



Commit f736acde0d02447833cfd0c3a021d2d560e5c9a6

teach channel threadCards on homepage not to multi-push to history

mix irving committed on 8/15/2017, 4:27:10 AM
Parent: 8f874fd336bd2bf7721b161985bb987d55bc8179

Files changed

app/html/thread-card.jschanged
app/page/home.jschanged
app/html/thread-card.jsView
@@ -82,12 +82,13 @@
8282 subject(thread)
8383 ])
8484
8585 const lastReply = thread.replies && maxBy(thread.replies, r => r.timestamp)
86+ const replySample = lastReply ? subject(lastReply) : null
8687
87- var replySample = lastReply ? subject(lastReply) : null
88+ const onClick = opts.onClick || function () { api.history.sync.push(thread) }
8889
89- return h('div.thread', {'ev-click': () => api.history.sync.push(thread)}, [
90+ return h('div.thread', {'ev-click': onClick }, [
9091 h('div.context', threadIcon(thread)),
9192 h('div.content', [
9293 subjectEl,
9394 replySample ? h('div.reply', [
app/page/home.jsView
@@ -105,21 +105,18 @@
105105 // but they are here to be compatible with the old MCSS.
106106 h('div.container', [
107107 //private section
108108 h('section.updates -directMessage', [
109- h('div.threads',
109+ h('div.threads',
110110 groupedThreads
111111 .map(function (thread) {
112- var el = api.app.html.threadCard(thread)
113112
114- if(thread.value.content.channel) {
115- el.onclick = function (ev) {
116- api.history.sync.push({channel: thread.value.content.channel})
117- ev.preventDefault()
118- }
119- }
113+ const channel = thread.value.content.channel
114+ const onClick = channel
115+ ? (ev) => api.history.sync.push({ channel })
116+ : null // threadCard will install default onClick
120117
121- return el
118+ return api.app.html.threadCard(thread, { onClick })
122119 })
123120 )
124121 ]),
125122 ])

Built with git-ssb-web