git ssb

10+

Matt McKegg / patchwork



Commit 5e26b5c3a8536e6be48e4c3324963f127b1e3fb0

fork rendering improvements

- link to fork root (with anchor to first message)
- don’t display duplicate fork messages (only first)
- don’t display fork messages on the forked root view
Matt McKegg committed on 10/18/2017, 11:13:29 AM
Parent: 3f14f6b6ebe8ee63641a6ffe734fbb1689543aa4

Files changed

modules/feed/html/rollup.jschanged
modules/message/html/backlinks.jschanged
modules/page/html/render/message.jschanged
modules/page/html/render/profile.jschanged
package.jsonchanged
plugs/message/html/layout/default.jschanged
plugs/message/html/layout/mini.jschanged
sbot/roots.jschanged
modules/feed/html/rollup.jsView
@@ -184,8 +184,9 @@
184184 })
185185
186186 var renderedMessage = api.message.html.render(item, {
187187 inContext: true,
188+ includeForks: false,
188189 priority: highlightItems.has(item.key) ? 2 : 0
189190 })
190191
191192 if (!renderedMessage) return h('div')
modules/message/html/backlinks.jsView
@@ -23,9 +23,9 @@
2323 var forks = (includeForks && msg.value.content.root) ? computed([backlinks, msg], onlyForks) : []
2424 return [
2525 map(forks, link => {
2626 return h('a.backlink', {
27- href: link.id, title: link.id
27+ href: msg.key, anchor: link.id
2828 }, [
2929 h('strong', [
3030 api.profile.html.person(link.author), i18n(' forked this discussion:')
3131 ]), ' ',
@@ -50,9 +50,9 @@
5050 return backlinks.filter(link => link.root !== msg.key && !includeOrEqual(link.branch, msg.key))
5151 }
5252
5353 function onlyForks (backlinks, msg) {
54- return backlinks.filter(link => link.root === msg.key && msg.value.content && msg.value.content.root)
54+ return backlinks.filter(link => link.root === msg.key && includeOrEqual(link.branch, msg.key) && msg.value.content && msg.value.content.root)
5555 }
5656
5757 function includeOrEqual (valueOrArray, item) {
5858 if (Array.isArray(valueOrArray)) {
modules/page/html/render/message.jsView
@@ -83,8 +83,9 @@
8383 }, [
8484 api.message.html.render(msg, {
8585 pageId: id,
8686 previousId,
87+ includeForks: msg.key !== id,
8788 includeReferences: true
8889 })
8990 ])
9091 })
modules/page/html/render/profile.jsView
@@ -13,8 +13,9 @@
1313 'blob.sync.url': 'first',
1414 'blob.html.input': 'first',
1515 'message.async.publish': 'first',
1616 'message.html.markdown': 'first',
17+ 'message.sync.root': 'first',
1718 'about.html.image': 'first',
1819 'feed.html.rollup': 'first',
1920 'feed.pull.profile': 'first',
2021 'sbot.async.publish': 'first',
@@ -187,9 +188,9 @@
187188
188189 var feedView = api.feed.html.rollup(api.feed.pull.profile(id), {
189190 prepend,
190191 displayFilter: (msg) => msg.value.author === id,
191- rootFilter: (msg) => !contact.youBlock(),
192+ rootFilter: (msg) => !contact.youBlock() && !api.message.sync.root(msg),
192193 bumpFilter: (msg) => msg.value.author === id
193194 })
194195
195196 var container = h('div', {className: 'SplitView'}, [
package.jsonView
@@ -39,9 +39,9 @@
3939 "mutant": "^3.21.2",
4040 "mutant-pull-reduce": "^1.1.0",
4141 "obv": "0.0.1",
4242 "patch-settings": "^1.0.1",
43- "patchcore": "~1.13.2",
43+ "patchcore": "~1.14.0",
4444 "pull-abortable": "^4.1.0",
4545 "pull-defer": "^0.2.2",
4646 "pull-file": "~1.0.0",
4747 "pull-identify-filetype": "^1.1.0",
plugs/message/html/layout/default.jsView
@@ -23,9 +23,9 @@
2323 exports.create = function (api) {
2424 const i18n = api.intl.sync.i18n
2525 return nest('message.html.layout', layout)
2626
27- function layout (msg, {layout, previousId, priority, content, includeReferences = false}) {
27+ function layout (msg, {layout, previousId, priority, content, includeReferences = false, includeForks = true}) {
2828 if (!(layout === undefined || layout === 'default')) return
2929
3030 var classList = ['Message']
3131 var replyInfo = null
@@ -59,9 +59,9 @@
5959 ])
6060 ])
6161 }
6262 }),
63- api.message.html.backlinks(msg, {includeReferences})
63+ api.message.html.backlinks(msg, {includeReferences, includeForks})
6464 ])
6565
6666 // scoped
6767
plugs/message/html/layout/mini.jsView
@@ -20,9 +20,9 @@
2020
2121 exports.create = function (api) {
2222 return nest('message.html.layout', layout)
2323
24- function layout (msg, {layout, previousId, priority, miniContent, content, includeReferences}) {
24+ function layout (msg, {layout, previousId, priority, miniContent, content, includeReferences, includeForks = true}) {
2525 if (!(layout === 'mini')) return
2626
2727 var classList = ['Message -mini']
2828 var replyInfo = null
@@ -58,9 +58,9 @@
5858 ])
5959 ])
6060 }
6161 }),
62- api.message.html.backlinks(msg, {includeReferences})
62+ api.message.html.backlinks(msg, {includeReferences, includeForks})
6363 ])
6464
6565 // scoped
6666
sbot/roots.jsView
@@ -68,9 +68,9 @@
6868
6969 // FILTER
7070 pull.filter(item => {
7171 var root = item.root || item
72- if (filter && root && root.value && !getRoot(root)) {
72+ if (filter && root && root.value) {
7373 return filter(ids, root)
7474 }
7575 })
7676 )

Built with git-ssb-web