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 viewMatt McKegg committed on 10/18/2017, 11:13:29 AM
Parent: 3f14f6b6ebe8ee63641a6ffe734fbb1689543aa4
Files changed
modules/feed/html/rollup.js | changed |
modules/message/html/backlinks.js | changed |
modules/page/html/render/message.js | changed |
modules/page/html/render/profile.js | changed |
package.json | changed |
plugs/message/html/layout/default.js | changed |
plugs/message/html/layout/mini.js | changed |
sbot/roots.js | changed |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -184,8 +184,9 @@ | ||
184 | 184 | }) |
185 | 185 | |
186 | 186 | var renderedMessage = api.message.html.render(item, { |
187 | 187 | inContext: true, |
188 | + includeForks: false, | |
188 | 189 | priority: highlightItems.has(item.key) ? 2 : 0 |
189 | 190 | }) |
190 | 191 | |
191 | 192 | if (!renderedMessage) return h('div') |
modules/message/html/backlinks.js | ||
---|---|---|
@@ -23,9 +23,9 @@ | ||
23 | 23 | var forks = (includeForks && msg.value.content.root) ? computed([backlinks, msg], onlyForks) : [] |
24 | 24 | return [ |
25 | 25 | map(forks, link => { |
26 | 26 | return h('a.backlink', { |
27 | - href: link.id, title: link.id | |
27 | + href: msg.key, anchor: link.id | |
28 | 28 | }, [ |
29 | 29 | h('strong', [ |
30 | 30 | api.profile.html.person(link.author), i18n(' forked this discussion:') |
31 | 31 | ]), ' ', |
@@ -50,9 +50,9 @@ | ||
50 | 50 | return backlinks.filter(link => link.root !== msg.key && !includeOrEqual(link.branch, msg.key)) |
51 | 51 | } |
52 | 52 | |
53 | 53 | 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) | |
55 | 55 | } |
56 | 56 | |
57 | 57 | function includeOrEqual (valueOrArray, item) { |
58 | 58 | if (Array.isArray(valueOrArray)) { |
modules/page/html/render/message.js | ||
---|---|---|
@@ -83,8 +83,9 @@ | ||
83 | 83 | }, [ |
84 | 84 | api.message.html.render(msg, { |
85 | 85 | pageId: id, |
86 | 86 | previousId, |
87 | + includeForks: msg.key !== id, | |
87 | 88 | includeReferences: true |
88 | 89 | }) |
89 | 90 | ]) |
90 | 91 | }) |
modules/page/html/render/profile.js | ||
---|---|---|
@@ -13,8 +13,9 @@ | ||
13 | 13 | 'blob.sync.url': 'first', |
14 | 14 | 'blob.html.input': 'first', |
15 | 15 | 'message.async.publish': 'first', |
16 | 16 | 'message.html.markdown': 'first', |
17 | + 'message.sync.root': 'first', | |
17 | 18 | 'about.html.image': 'first', |
18 | 19 | 'feed.html.rollup': 'first', |
19 | 20 | 'feed.pull.profile': 'first', |
20 | 21 | 'sbot.async.publish': 'first', |
@@ -187,9 +188,9 @@ | ||
187 | 188 | |
188 | 189 | var feedView = api.feed.html.rollup(api.feed.pull.profile(id), { |
189 | 190 | prepend, |
190 | 191 | displayFilter: (msg) => msg.value.author === id, |
191 | - rootFilter: (msg) => !contact.youBlock(), | |
192 | + rootFilter: (msg) => !contact.youBlock() && !api.message.sync.root(msg), | |
192 | 193 | bumpFilter: (msg) => msg.value.author === id |
193 | 194 | }) |
194 | 195 | |
195 | 196 | var container = h('div', {className: 'SplitView'}, [ |
package.json | ||
---|---|---|
@@ -39,9 +39,9 @@ | ||
39 | 39 | "mutant": "^3.21.2", |
40 | 40 | "mutant-pull-reduce": "^1.1.0", |
41 | 41 | "obv": "0.0.1", |
42 | 42 | "patch-settings": "^1.0.1", |
43 | - "patchcore": "~1.13.2", | |
43 | + "patchcore": "~1.14.0", | |
44 | 44 | "pull-abortable": "^4.1.0", |
45 | 45 | "pull-defer": "^0.2.2", |
46 | 46 | "pull-file": "~1.0.0", |
47 | 47 | "pull-identify-filetype": "^1.1.0", |
plugs/message/html/layout/default.js | ||
---|---|---|
@@ -23,9 +23,9 @@ | ||
23 | 23 | exports.create = function (api) { |
24 | 24 | const i18n = api.intl.sync.i18n |
25 | 25 | return nest('message.html.layout', layout) |
26 | 26 | |
27 | - function layout (msg, {layout, previousId, priority, content, includeReferences = false}) { | |
27 | + function layout (msg, {layout, previousId, priority, content, includeReferences = false, includeForks = true}) { | |
28 | 28 | if (!(layout === undefined || layout === 'default')) return |
29 | 29 | |
30 | 30 | var classList = ['Message'] |
31 | 31 | var replyInfo = null |
@@ -59,9 +59,9 @@ | ||
59 | 59 | ]) |
60 | 60 | ]) |
61 | 61 | } |
62 | 62 | }), |
63 | - api.message.html.backlinks(msg, {includeReferences}) | |
63 | + api.message.html.backlinks(msg, {includeReferences, includeForks}) | |
64 | 64 | ]) |
65 | 65 | |
66 | 66 | // scoped |
67 | 67 |
plugs/message/html/layout/mini.js | ||
---|---|---|
@@ -20,9 +20,9 @@ | ||
20 | 20 | |
21 | 21 | exports.create = function (api) { |
22 | 22 | return nest('message.html.layout', layout) |
23 | 23 | |
24 | - function layout (msg, {layout, previousId, priority, miniContent, content, includeReferences}) { | |
24 | + function layout (msg, {layout, previousId, priority, miniContent, content, includeReferences, includeForks = true}) { | |
25 | 25 | if (!(layout === 'mini')) return |
26 | 26 | |
27 | 27 | var classList = ['Message -mini'] |
28 | 28 | var replyInfo = null |
@@ -58,9 +58,9 @@ | ||
58 | 58 | ]) |
59 | 59 | ]) |
60 | 60 | } |
61 | 61 | }), |
62 | - api.message.html.backlinks(msg, {includeReferences}) | |
62 | + api.message.html.backlinks(msg, {includeReferences, includeForks}) | |
63 | 63 | ]) |
64 | 64 | |
65 | 65 | // scoped |
66 | 66 |
Built with git-ssb-web