Commit e79d34134f281a91928cfc9729fcc40cdc3a88d4
standardize!
Matt McKegg committed on 10/19/2017, 2:53:42 AMParent: a69b107634854812d8fe243ff4f0ce3e4e19bd8c
Files changed
plugs/message/html/meta/likes.js | ||
---|---|---|
@@ -5,9 +5,9 @@ | ||
5 | 5 | exports.needs = nest({ |
6 | 6 | 'message.obs.likes': 'first', |
7 | 7 | 'sheet.profiles': 'first', |
8 | 8 | 'about.obs.name': 'first', |
9 | - 'intl.sync.i18n': 'first', | |
9 | + 'intl.sync.i18n': 'first' | |
10 | 10 | }) |
11 | 11 | |
12 | 12 | exports.create = function (api) { |
13 | 13 | const i18n = api.intl.sync.i18n |
plugs/message/html/render/about.js | ||
---|---|---|
@@ -13,9 +13,9 @@ | ||
13 | 13 | 'keys.sync.id': 'first', |
14 | 14 | 'profile.html.person': 'first', |
15 | 15 | 'about.obs.name': 'first', |
16 | 16 | 'blob.sync.url': 'first', |
17 | - 'intl.sync.i18n': 'first', | |
17 | + 'intl.sync.i18n': 'first' | |
18 | 18 | }) |
19 | 19 | |
20 | 20 | exports.gives = nest('message.html', { |
21 | 21 | canRender: true, |
@@ -26,9 +26,9 @@ | ||
26 | 26 | const i18n = api.intl.sync.i18n |
27 | 27 | return nest('message.html', { |
28 | 28 | canRender: isRenderable, |
29 | 29 | render: function (msg, opts) { |
30 | - if (!isRenderable(msg)) return; | |
30 | + if (!isRenderable(msg)) return | |
31 | 31 | |
32 | 32 | var c = msg.value.content |
33 | 33 | var self = msg.value.author === c.about |
34 | 34 | |
@@ -85,10 +85,10 @@ | ||
85 | 85 | return elements |
86 | 86 | } |
87 | 87 | }) |
88 | 88 | |
89 | - function isRenderable(msg) { | |
90 | - if (msg.value.content.type !== 'about') return undefined | |
91 | - else if (!ref.isFeed(msg.value.content.about)) return undefined | |
89 | + function isRenderable (msg) { | |
90 | + if (msg.value.content.type !== 'about') return | |
91 | + if (!ref.isFeed(msg.value.content.about)) return | |
92 | 92 | return true |
93 | 93 | } |
94 | 94 | } |
plugs/message/html/render/attending.js | ||
---|---|---|
@@ -15,12 +15,12 @@ | ||
15 | 15 | canRender: true, |
16 | 16 | render: true |
17 | 17 | }) |
18 | 18 | |
19 | -exports.create = function(api) { | |
19 | +exports.create = function (api) { | |
20 | 20 | return nest('message.html', { |
21 | 21 | canRender: isRenderable, |
22 | - render: function about(msg, opts) { | |
22 | + render: function about (msg, opts) { | |
23 | 23 | if (!isRenderable(msg)) return |
24 | 24 | |
25 | 25 | var action = msg.value.content.attendee.remove ? `can't attend` : 'is attending' |
26 | 26 | var target = msg.value.content.about |
@@ -38,12 +38,12 @@ | ||
38 | 38 | }) |
39 | 39 | } |
40 | 40 | }) |
41 | 41 | |
42 | - function isRenderable(msg) { | |
43 | - if (msg.value.content.type !== 'about') return undefined | |
44 | - else if (!ref.isMsg(msg.value.content.about)) return undefined | |
45 | - else if (!msg.value.content.attendee) return undefined | |
46 | - else if (msg.value.content.attendee.link !== msg.value.author) return undefined | |
47 | - else return true | |
42 | + function isRenderable (msg) { | |
43 | + if (msg.value.content.type !== 'about') return | |
44 | + if (!ref.isMsg(msg.value.content.about)) return | |
45 | + if (!msg.value.content.attendee) return | |
46 | + if (msg.value.content.attendee.link !== msg.value.author) return | |
47 | + return true | |
48 | 48 | } |
49 | 49 | } |
plugs/message/html/render/channel.js | ||
---|---|---|
@@ -6,17 +6,17 @@ | ||
6 | 6 | 'message.html': { |
7 | 7 | decorate: 'reduce', |
8 | 8 | layout: 'first' |
9 | 9 | }, |
10 | - 'intl.sync.i18n': 'first', | |
10 | + 'intl.sync.i18n': 'first' | |
11 | 11 | }) |
12 | 12 | |
13 | 13 | exports.gives = nest('message.html', { |
14 | 14 | canRender: true, |
15 | 15 | render: true |
16 | 16 | }) |
17 | 17 | |
18 | -exports.create = function(api) { | |
18 | +exports.create = function (api) { | |
19 | 19 | const i18n = api.intl.sync.i18n |
20 | 20 | return nest('message.html', { |
21 | 21 | canRender: isRenderable, |
22 | 22 | render: function (msg, opts) { |
@@ -31,9 +31,9 @@ | ||
31 | 31 | }) |
32 | 32 | } |
33 | 33 | }) |
34 | 34 | |
35 | - function messageContent(msg) { | |
35 | + function messageContent (msg) { | |
36 | 36 | var channel = `#${msg.value.content.channel}` |
37 | 37 | var subscribed = msg.value.content.subscribed |
38 | 38 | return [ |
39 | 39 | subscribed ? i18n('subscribed to ') : i18n('unsubscribed from '), |
@@ -43,7 +43,7 @@ | ||
43 | 43 | ] |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -function isRenderable(msg) { | |
47 | +function isRenderable (msg) { | |
48 | 48 | return msg.value.content.type === 'channel' ? true : undefined |
49 | 49 | } |
plugs/message/html/render/following.js | ||
---|---|---|
@@ -1,5 +1,4 @@ | ||
1 | -var h = require('mutant/h') | |
2 | 1 | var nest = require('depnest') |
3 | 2 | var extend = require('xtend') |
4 | 3 | var ref = require('ssb-ref') |
5 | 4 | |
@@ -8,21 +7,21 @@ | ||
8 | 7 | decorate: 'reduce', |
9 | 8 | layout: 'first' |
10 | 9 | }, |
11 | 10 | 'profile.html.person': 'first', |
12 | - 'intl.sync.i18n': 'first', | |
11 | + 'intl.sync.i18n': 'first' | |
13 | 12 | }) |
14 | 13 | |
15 | 14 | exports.gives = nest('message.html', { |
16 | 15 | canRender: true, |
17 | 16 | render: true |
18 | 17 | }) |
19 | 18 | |
20 | -exports.create = function(api) { | |
19 | +exports.create = function (api) { | |
21 | 20 | const i18n = api.intl.sync.i18n |
22 | 21 | return nest('message.html', { |
23 | 22 | canRender: isRenderable, |
24 | - render: function(msg, opts) { | |
23 | + render: function (msg, opts) { | |
25 | 24 | if (!isRenderable(msg)) return |
26 | 25 | |
27 | 26 | var element = api.message.html.layout(msg, extend({ |
28 | 27 | miniContent: messageContent(msg), |
@@ -34,9 +33,9 @@ | ||
34 | 33 | }) |
35 | 34 | } |
36 | 35 | }) |
37 | 36 | |
38 | - function messageContent(msg) { | |
37 | + function messageContent (msg) { | |
39 | 38 | var following = msg.value.content.following |
40 | 39 | var blocking = msg.value.content.blocking |
41 | 40 | |
42 | 41 | if (blocking === true) { |
@@ -54,12 +53,11 @@ | ||
54 | 53 | ] |
55 | 54 | } |
56 | 55 | } |
57 | 56 | |
58 | - function isRenderable(msg) { | |
59 | - if (msg.value.content.type !== 'contact') return undefined | |
60 | - else if (!ref.isFeed(msg.value.content.contact)) return undefined | |
61 | - else if (typeof msg.value.content.following !== 'boolean' && typeof msg.value.content.blocking !== 'boolean') return undefined | |
62 | - return true; | |
57 | + function isRenderable (msg) { | |
58 | + if (msg.value.content.type !== 'contact') return | |
59 | + if (!ref.isFeed(msg.value.content.contact)) return | |
60 | + if (typeof msg.value.content.following !== 'boolean' && typeof msg.value.content.blocking !== 'boolean') return | |
61 | + return true | |
63 | 62 | } |
64 | - | |
65 | 63 | } |
plugs/message/html/render/gathering.js | ||
---|---|---|
@@ -23,14 +23,14 @@ | ||
23 | 23 | canRender: true, |
24 | 24 | render: true |
25 | 25 | }) |
26 | 26 | |
27 | -exports.create = function(api) { | |
27 | +exports.create = function (api) { | |
28 | 28 | var following = null |
29 | 29 | |
30 | 30 | return nest('message.html', { |
31 | 31 | canRender: isRenderable, |
32 | - render: function(msg, opts) { | |
32 | + render: function (msg, opts) { | |
33 | 33 | if (!isRenderable(msg)) return |
34 | 34 | |
35 | 35 | var yourId = api.keys.sync.id() |
36 | 36 | var hidden = api.about.obs.valueFrom(msg.key, 'hidden', yourId) |
@@ -38,9 +38,9 @@ | ||
38 | 38 | var title = api.about.obs.latestValue(msg.key, 'title') |
39 | 39 | var description = api.about.obs.latestValue(msg.key, 'description') |
40 | 40 | var location = api.about.obs.latestValue(msg.key, 'location') |
41 | 41 | var startDateTime = api.about.obs.latestValue(msg.key, 'startDateTime') |
42 | - var endDateTime = api.about.obs.latestValue(msg.key, 'endDateTime') | |
42 | + // var endDateTime = api.about.obs.latestValue(msg.key, 'endDateTime') | |
43 | 43 | var attendees = computed([api.about.obs.groupedValues(msg.key, 'attendee')], getAttendees) |
44 | 44 | if (!following) { |
45 | 45 | following = api.contact.obs.following(yourId) |
46 | 46 | } |
@@ -102,9 +102,9 @@ | ||
102 | 102 | })) |
103 | 103 | } |
104 | 104 | }) |
105 | 105 | |
106 | - function publishAttending(id) { | |
106 | + function publishAttending (id) { | |
107 | 107 | var yourId = api.keys.sync.id() |
108 | 108 | |
109 | 109 | // publish with confirm |
110 | 110 | api.message.async.publish({ |
@@ -115,9 +115,9 @@ | ||
115 | 115 | } |
116 | 116 | }) |
117 | 117 | } |
118 | 118 | |
119 | - function publishNotAttending(id) { | |
119 | + function publishNotAttending (id) { | |
120 | 120 | var yourId = api.keys.sync.id() |
121 | 121 | |
122 | 122 | // publish with confirm |
123 | 123 | api.message.async.publish({ |
@@ -129,11 +129,11 @@ | ||
129 | 129 | } |
130 | 130 | }) |
131 | 131 | } |
132 | 132 | |
133 | - function nameAndFollowWarning(id) { | |
133 | + function nameAndFollowWarning (id) { | |
134 | 134 | var yourId = api.keys.sync.id() |
135 | - return computed([api.about.obs.name(id), id, following], function nameAndFollowWarning(name, id, following) { | |
135 | + return computed([api.about.obs.name(id), id, following], function nameAndFollowWarning (name, id, following) { | |
136 | 136 | if (id === yourId) { |
137 | 137 | return `${name} (you)` |
138 | 138 | } else if (following.includes(id)) { |
139 | 139 | return `${name}` |
@@ -142,24 +142,24 @@ | ||
142 | 142 | } |
143 | 143 | }) |
144 | 144 | } |
145 | 145 | |
146 | - function markdown(obs) { | |
146 | + function markdown (obs) { | |
147 | 147 | return computed(obs, (text) => { |
148 | 148 | if (typeof text === 'string') return api.message.html.markdown(text) |
149 | 149 | }) |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | -function formatTime(time) { | |
153 | +function formatTime (time) { | |
154 | 154 | if (time && time.epoch) { |
155 | 155 | return moment(time.epoch).format('LLLL') |
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | -function getAttendees(lookup) { | |
159 | +function getAttendees (lookup) { | |
160 | 160 | return Object.keys(lookup) |
161 | 161 | } |
162 | 162 | |
163 | -function isRenderable(msg) { | |
163 | +function isRenderable (msg) { | |
164 | 164 | return (msg.value.content.type === 'gathering') ? true : undefined |
165 | 165 | } |
Built with git-ssb-web