git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Commit e29b9cacf9b2690e0622dde43b93bdaa71290524

make it possible to send encrypted stars, and always show if mini messages are private

Ev Bogue committed on 6/21/2018, 4:36:11 PM
Parent: b75e0e122b771dcc2f483ba17d0e0c5db371fd9b

Files changed

render.jschanged
tools.jschanged
render.jsView
@@ -169,9 +169,9 @@
169169 var link = h('span', ' ', h('img.emoji', {src: config.emojiUrl + 'stars.png'}), ' ', h('a', {href: '#' + msg.value.content.vote.link}, tools.messageLink(msg.value.content.vote.link)))
170170 message.appendChild(tools.mini(msg, link))
171171 return message
172172 } else if (typeof msg.value.content === 'string') {
173- var privateMsg = h('span', ' ', h('img.emoji', {src: config.emojiUrl + 'lock.png'}))
173+ var privateMsg = h('span', ' sent a private message.')
174174 message.appendChild(tools.mini(msg, privateMsg))
175175 return message
176176 } else {
177177
tools.jsView
@@ -232,13 +232,20 @@
232232 var vote = {
233233 type: 'vote',
234234 vote: { link: msg.key, expression: 'Star' }
235235 }
236+ console.log(msg)
237+ if (msg.value.content.recps) {
238+ vote.recps = msg.value.content.recps
239+ }
236240
237241 var star = h('button.btn.right', 'Star ',
238242 h('img.emoji', {src: config.emojiUrl + 'star.png'}), {
239243 onclick: function () {
240244 vote.vote.value = 1
245+ if (vote.recps) {
246+ vote = exports.box(vote)
247+ }
241248 sbot.publish(vote, function (err, voted) {
242249 if(err) throw err
243250 })
244251 }
@@ -323,18 +330,33 @@
323330 }
324331
325332
326333 module.exports.mini = function (msg, content) {
327- return h('div.mini',
334+ var mini = h('div.mini')
335+
336+ mini.appendChild(
328337 h('span.avatar',
329338 h('a', {href: '#' + msg.value.author},
330339 h('span.avatar--small', avatar.image(msg.value.author)),
331340 avatar.name(msg.value.author)
332341 )
333- ),
334- exports.timestamp(msg),
335- content
342+ )
336343 )
344+ var lock = h('span.right', h('img.emoji', {src: config.emojiUrl + 'lock.png'}))
345+
346+
347+ mini.appendChild(content)
348+ mini.appendChild(exports.timestamp(msg))
349+
350+ if (msg.value.content.recps) {
351+ mini.appendChild(lock)
352+ }
353+
354+ if (typeof msg.value.content === 'string') {
355+ mini.appendChild(lock)
356+ }
357+
358+ return mini
337359 }
338360
339361
340362 module.exports.header = function (msg) {

Built with git-ssb-web