Commit c1bbd85b688758bb943822743d5ad75bf3761ab1
only add a person to msg.recps once
Matt McKegg committed on 12/8/2017, 3:01:56 AMParent: 14aa0c908e6998e264adfa0aeba8af2113dd4286
Files changed
modules/page/html/render/private.js | changed |
modules/page/html/render/private.js | ||
---|---|---|
@@ -21,11 +21,17 @@ | ||
21 | 21 | var compose = api.message.html.compose({ |
22 | 22 | meta: {type: 'post'}, |
23 | 23 | isPrivate: true, |
24 | 24 | prepublish: function (msg) { |
25 | - msg.recps = [id].concat(msg.mentions).filter(function (e) { | |
26 | - return ref.isFeed(typeof e === 'string' ? e : e.link) | |
25 | + msg.recps = [id] | |
26 | + | |
27 | + msg.mentions.forEach(mention => { | |
28 | + mention = typeof mention === 'string' ? mention : mention.link | |
29 | + if (ref.isFeed(mention) && !msg.recps.includes(mention)) { | |
30 | + msg.recps.push(mention) | |
31 | + } | |
27 | 32 | }) |
33 | + | |
28 | 34 | return msg |
29 | 35 | }, |
30 | 36 | placeholder: i18n('Write a private message') |
31 | 37 | }) |
Built with git-ssb-web