git ssb

16+

Dominic / patchbay



Commit dd89aea89ea78d2da4756933408ebf980ca82e38

merge metadata on confirm, and render messages non-compact in message-confirm

Dominic Tarr committed on 10/24/2016, 9:10:45 PM
Parent: 9916a3c063184f892f6b76d2865ecd6b8b3af8b8
Parent: a99ebfa5196c74139b834f92923457aa74def9bc

Files changed

modules/follow.jschanged
modules/like.jschanged
modules/message-confirm.jschanged
modules/message.jschanged
modules/private.jschanged
modules/follow.jsView
@@ -12,8 +12,9 @@
1212 function isRelated(value, name) {
1313 return value ? name : value === false ? 'un'+name : ''
1414 }
1515
16 +exports.message_content =
1617 exports.message_content_mini = function (msg) {
1718 var content = msg.value.content
1819 if(content.type == 'contact' && content.contact) {
1920 var relation = isRelated(content.following, 'follows')
modules/like.jsView
@@ -8,8 +8,10 @@
88 var message_confirm = plugs.first(exports.message_confirm = [])
99 var message_link = plugs.first(exports.message_link = [])
1010 var sbot_links = plugs.first(exports.sbot_links = [])
1111
12 +
13 +exports.message_content =
1214 exports.message_content_mini = function (msg, sbot) {
1315 if(msg.value.content.type !== 'vote') return
1416 var link = msg.value.content.vote.link
1517 return [
modules/message-confirm.jsView
@@ -1,22 +1,36 @@
11 var lightbox = require('hyperlightbox')
22 var h = require('hyperscript')
33 var u = require('../util')
4 +var self_id = require('../keys').id
45 //publish or add
56
67 var plugs = require('../plugs')
78
89 var publish = plugs.first(exports.sbot_publish = [])
910 var message_content = plugs.first(exports.message_content = [])
11 +var avatar = plugs.first(exports.avatar = [])
12 +var message_meta = plugs.map(exports.message_meta = [])
1013
1114 exports.message_confirm = function (content, cb) {
1215
1316 cb = cb || function () {}
1417
1518 var lb = lightbox()
1619 document.body.appendChild(lb)
1720
18- var okay = h('button', 'Publish', {onclick: function () {
21 + var msg = {
22 + key: "DRAFT",
23 + value: {
24 + author: self_id,
25 + previous: null,
26 + sequence: null,
27 + timestamp: Date.now(),
28 + content: content
29 + }
30 + }
31 +
32 + var okay = h('button', 'okay', {onclick: function () {
1933 lb.remove()
2034 publish(content, cb)
2135 }})
2236
@@ -29,30 +43,19 @@
2943 if(ev.keyCode === 27) cancel.click() //escape
3044 })
3145
3246 lb.show(h('div.column.message-confirm',
33- message_content({key: "DRAFT", value: {content: content}})
34- || h('pre', JSON.stringify(content, null, 2)),
47 + h('div.message',
48 + h('div.title.row',
49 + h('div.avatar', avatar(msg.value.author, 'thumbnail')),
50 + h('div.message_meta.row', message_meta(msg))
51 + ),
52 + h('div.message_content', message_content(msg)
53 + || h('pre', JSON.stringify(msg, null, 2)))
54 + ),
3555 h('div.row.message-confirm__controls', okay, cancel)
3656 ))
3757
3858 okay.focus()
3959
4060 }
4161
42-
43-
44-
45-
46-
47-
48-
49-
50-
51-
52-
53-
54-
55-
56-
57-
58-
modules/message.jsView
@@ -1,10 +1,8 @@
11 var h = require('hyperscript')
22 var u = require('../util')
33 var pull = require('pull-stream')
44
5-
6-
75 var plugs = require('../plugs')
86 var message_content = plugs.first(exports.message_content = [])
97 var message_content_mini = plugs.first(exports.message_content_mini = [])
108 var avatar = plugs.first(exports.avatar = [])
modules/private.jsView
@@ -76,9 +76,9 @@
7676 if(Array.isArray(ary)) return ary.map(iter)
7777 }
7878
7979 exports.message_meta = function (msg) {
80- if(msg.value.private)
80 + if(msg.value.content.recps || msg.value.private)
8181 return h('span.row', 'PRIVATE', map(msg.value.content.recps, function (id) {
8282 return avatar_image_link('string' == typeof id ? id : id.link, 'thumbnail')
8383 }))
8484 }

Built with git-ssb-web