git ssb

2+

mixmix / ticktack



Commit 17795d6b64c14a6b4619d142e0f05e3e8e3b2562

Merge remote-tracking branch 'origin/home_page_tweaks'

Dominic Tarr committed on 8/17/2017, 5:21:23 AM
Parent: e2d5bfd85bf6a1e43f4cf5d1f8b8980d5830ecba
Parent: c1e3521f9e2d90a0532d013640e269df8377760d

Files changed

app/html/thread-card.jschanged
app/html/thread-card.jsView
@@ -20,19 +20,20 @@
2020 //get the first non-empty line
2121 var line = text.trim().split('\n').shift().trim()
2222
2323 //always break on a space, so that links are preserved.
24- var i = line.indexOf(' ', 80)
24+ const leadingMentionsLength = countLeadingMentions(line)
25+ const i = line.indexOf(' ', leadingMentionsLength + 80)
2526 var sample = line.substring(0, ~i ? i : line.length)
2627
2728 const ellipsis = (sample.length < line.length) ? '...' : ''
2829 return sample + ellipsis
2930 }
3031
31-// function trimLeadingMentions (str) {
32-// return str.replace(/^(\s*\[@[^\)]+\)\s*)*/, '')
33-// // deletes any number of pattern " [@...) " from start of line
34-// }
32+function countLeadingMentions (str) {
33+ return str.match(/^(\s*\[@[^\)]+\)\s*)*/)[0].length
34+ // matches any number of pattern " [@...) " from start of line
35+}
3536
3637 exports.create = function (api) {
3738
3839 //render the icon for a thread.
@@ -85,9 +86,9 @@
8586 const lastReply = thread.replies && maxBy(thread.replies, r => r.timestamp)
8687 const replySample = lastReply ? subject(lastReply) : null
8788
8889 const onClick = opts.onClick || function () { api.history.sync.push(thread) }
89- const id = `${thread.key}-${JSON.stringify(opts)}`
90+ const id = `${thread.key.replace(/[^a-z0-9]/gi, '')}` //-${JSON.stringify(opts)}`
9091 // id is only here to help morphdom morph accurately
9192
9293 return h('ThreadCard', { 'ev-click': onClick, id }, [
9394 h('div.context', threadIcon(thread)),

Built with git-ssb-web