git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit dbcaed4a38e2a45014c7a8a7e73a0b5e53164c31

render blocked messages in feed

Matt McKegg committed on 10/14/2017, 1:51:21 AM
Parent: c1dde42baae907203eb924698df2f59d0a5ed30b

Files changed

locales/en.jsonchanged
plugs/message/html/render/following.jschanged
locales/en.jsonView
@@ -145,6 +145,8 @@
145145 "Unblock": "Unblock",
146146 "Block": "Block",
147147 "Click to unblock": "Click to unblock",
148148 "Blocked": "Blocked",
149- "pt": "pt"
149+ "pt": "pt",
150+ "blocked ": "blocked ",
151+ "unblocked ": "unblocked "
150152 }
plugs/message/html/render/following.jsView
@@ -18,9 +18,9 @@
1818 const i18n = api.intl.sync.i18n
1919 return nest('message.html.render', function renderMessage (msg, opts) {
2020 if (msg.value.content.type !== 'contact') return
2121 if (!ref.isFeed(msg.value.content.contact)) return
22- if (typeof msg.value.content.following !== 'boolean') return
22+ if (typeof msg.value.content.following !== 'boolean' && typeof msg.value.content.blocking !== 'boolean') return
2323
2424 var element = api.message.html.layout(msg, extend({
2525 miniContent: messageContent(msg),
2626 layout: 'mini'
@@ -30,10 +30,19 @@
3030 })
3131
3232 function messageContent (msg) {
3333 var following = msg.value.content.following
34- return [
35- following ? i18n('followed ') : i18n('unfollowed '),
36- api.profile.html.person(msg.value.content.contact)
37- ]
34+ var blocking = msg.value.content.blocking
35+
36+ if (typeof blocking === 'boolean') {
37+ return [
38+ blocking ? i18n('blocked ') : i18n('unblocked '),
39+ api.profile.html.person(msg.value.content.contact)
40+ ]
41+ } else {
42+ return [
43+ following ? i18n('followed ') : i18n('unfollowed '),
44+ api.profile.html.person(msg.value.content.contact)
45+ ]
46+ }
3847 }
3948 }

Built with git-ssb-web