Commit 986ca1380e3f18f97a8d0a8b01c67079005ab91c
render following and blocking correctly
Dominic Tarr committed on 7/25/2016, 8:32:06 PMParent: 8ecc2b31db3e6fad1ecee253703e89b979f4ae62
Files changed
modules/follow.js | changed |
modules/follow.js | ||
---|---|---|
@@ -5,14 +5,22 @@ | ||
5 | 5 | var plugs = require('../plugs') |
6 | 6 | |
7 | 7 | //render a message when someone follows someone, |
8 | 8 | //so you see new users |
9 | +function isRelated(value, name) { | |
10 | + return value ? name : value === false ? 'un'+name : '' | |
11 | +} | |
12 | + | |
9 | 13 | exports.message_content = function (msg) { |
10 | 14 | |
11 | - if(msg.value.content.type == 'contact' && msg.value.content.contact) { | |
12 | - return h('div.contact', | |
13 | - 'follows', | |
14 | - avatar(msg.value.content.contact, 'thumbnail') | |
15 | + var content = msg.value.content | |
16 | + if(content.type == 'contact' && content.contact) { | |
17 | + var relation = content.following ? 'follows' : 'unfollows' | |
18 | + return h('div.contact', [ | |
19 | + isRelated(content.following, 'follows'), | |
20 | + isRelated(content.blocking, 'blocks') | |
21 | + ].filter(Boolean).join(' and ') | |
22 | + , avatar(msg.value.content.contact, 'thumbnail') | |
15 | 23 | ) |
16 | 24 | } |
17 | 25 | } |
18 | 26 | |
@@ -81,4 +89,18 @@ | ||
81 | 89 | }}, h('br'), label) |
82 | 90 | ) |
83 | 91 | } |
84 | 92 | |
93 | + | |
94 | + | |
95 | + | |
96 | + | |
97 | + | |
98 | + | |
99 | + | |
100 | + | |
101 | + | |
102 | + | |
103 | + | |
104 | + | |
105 | + | |
106 | + |
Built with git-ssb-web