git ssb

16+

Dominic / patchbay



Commit 508894a815eee17488cd4f6666209a4038721053

Merge branch 'master' into channel-input

Bradley Donahue committed on 2/5/2017, 7:14:40 PM
Parent: 1445c8065b8c93c516ef1df601881a70c5201081
Parent: 86ea5da17a73751facaa9e0d8540e9877b49f402

Files changed

modules_basic/like.jschanged
modules_basic/message/render.mcsschanged
modules_basic/private.jschanged
modules_extra/channel.jschanged
modules_extra/raw.jschanged
package.jsonchanged
modules_basic/like.jsView
@@ -41,11 +41,13 @@
4141 }
4242
4343 if (votes.length === 0) return
4444
45 + const symbol = '\u2713' // tick 🗸
46 +
4547 digs.textContent = votes.length > 4
46- ? votes.length + ' \u2713'
47- : Array(votes.length).fill('\u2713').join('')
48 + ? votes.length + ' ' + symbol
49 + : Array(votes.length).fill(symbol).join('')
4850
4951 pull(
5052 pull.values(votes.map(vote => api.avatar_name(vote.source))),
5153 pull.collect((err, ary) => {
modules_basic/message/render.mcssView
@@ -27,8 +27,15 @@
2727
2828 a {
2929 $textSubtle
3030 }
31 +
32 + /* this is for private message_meta, TODO find a better home */
33 + (img) {
34 + height: 1.8rem
35 + width: 1.8rem
36 + margin: 0 .2rem -.2rem
37 + }
3138 }
3239
3340 section.content {
3441 flex-basis: 100%
modules_basic/private.jsView
@@ -1,10 +1,11 @@
11 'use strict'
2-var h = require('hyperscript')
3-var u = require('../util')
4-var pull = require('pull-stream')
5-var Scroller = require('pull-scroll')
6-var ref = require('ssb-ref')
2 +const fs = require('fs')
3 +const h = require('../h')
4 +const u = require('../util')
5 +const pull = require('pull-stream')
6 +const Scroller = require('pull-scroll')
7 +const ref = require('ssb-ref')
78
89 function map(ary, iter) {
910 if(Array.isArray(ary)) return ary.map(iter)
1011 }
@@ -23,9 +24,10 @@
2324 exports.gives = {
2425 builtin_tabs: true,
2526 screen_view: true,
2627 message_meta: true,
27- message_content_mini: true
28 + message_content_mini: true,
29 + // mcss: true
2830 }
2931
3032 exports.create = function (api) {
3133
@@ -41,74 +43,90 @@
4143 )
4244 }
4345
4446 return {
45- builtin_tabs: function () {
46- return ['/private']
47- },
47 + builtin_tabs,
48 + screen_view,
49 + message_meta,
50 + message_content_mini,
51 + // mcss: () => fs.readFileSync(__filename.replace(/js$/, 'mcss'), 'utf8')
52 + }
4853
49- screen_view: function (path) {
50- if(path !== '/private') return
54 + function builtin_tabs () {
55 + return ['/private']
56 + }
5157
52- var composer = api.message_compose(
53- {type: 'post', recps: [], private: true},
54- {
55- prepublish: function (msg) {
56- msg.recps = [id].concat(msg.mentions).filter(function (e) {
57- return ref.isFeed('string' === typeof e ? e : e.link)
58- })
59- if(!msg.recps.length)
60- throw new Error('cannot make private message without recipients - just mention the user in an at reply in the message you send')
61- return msg
62- },
63- placeholder: 'Write a private message'
64- }
65- )
66- var { container, content } = api.build_scroller({ prepend: composer })
58 + function screen_view (path) {
59 + if(path !== '/private') return
6760
68- // if local id is different from sbot id, sbot won't have indexes of
69- // private threads
70- //TODO: put all private indexes client side.
71- var id = require('../keys').id
72- api.sbot_whoami(function (err, feed) {
73- if (err) return console.error(err)
74- if(id !== feed.id)
75- return container.appendChild(h('h4',
76- 'Private messages are not supported in the lite client.'))
61 + var composer = api.message_compose(
62 + {type: 'post', recps: [], private: true},
63 + {
64 + prepublish: function (msg) {
65 + msg.recps = [id].concat(msg.mentions).filter(function (e) {
66 + return ref.isFeed('string' === typeof e ? e : e.link)
67 + })
68 + if(!msg.recps.length)
69 + throw new Error('cannot make private message without recipients - just mention the user in an at reply in the message you send')
70 + return msg
71 + },
72 + placeholder: 'Write a private message'
73 + }
74 + )
75 + var { container, content } = api.build_scroller({ prepend: composer })
7776
78- pull(
79- u.next(api.sbot_log, {old: false, limit: 100}),
80- unbox(),
81- Scroller(container, content, api.message_render, true, false)
82- )
77 + // if local id is different from sbot id, sbot won't have indexes of
78 + // private threads
79 + //TODO: put all private indexes client side.
80 + var id = require('../keys').id
81 + api.sbot_whoami(function (err, feed) {
82 + if (err) return console.error(err)
83 + if(id !== feed.id)
84 + return container.appendChild(h('h4',
85 + 'Private messages are not supported in the lite client.'))
8386
84- pull(
85- u.next(api.sbot_log, {reverse: true, limit: 1000}),
86- unbox(),
87- Scroller(container, content, api.message_render, false, false, function (err) {
88- if(err) throw err
89- })
90- )
91- })
87 + pull(
88 + u.next(api.sbot_log, {old: false, limit: 100}),
89 + unbox(),
90 + Scroller(container, content, api.message_render, true, false)
91 + )
9292
93- return container
94- },
93 + pull(
94 + u.next(api.sbot_log, {reverse: true, limit: 1000}),
95 + unbox(),
96 + Scroller(container, content, api.message_render, false, false, function (err) {
97 + if(err) throw err
98 + })
99 + )
100 + })
95101
96- message_meta: function (msg) {
97- if(msg.value.content.recps || msg.value.private)
98- return h('span.row', 'PRIVATE', map(msg.value.content.recps, function (id) {
99- return api.avatar_image_link('string' == typeof id ? id : id.link, 'thumbnail')
100- }))
101- },
102 + return container
103 + }
102104
103- message_content_mini: function (msg, sbot) {
104- if (typeof msg.value.content === 'string') {
105- var icon = api.emoji_url('lock')
106- return icon
107- ? h('img', {className: 'emoji', src: icon})
108- : 'PRIVATE'
105 + function message_meta (msg) {
106 + if(!msg.value.content.recps && ! msg.value.private) return
107 +
108 + return h('div', {
109 + style: {
110 + display: 'flex',
111 + 'align-items': 'center',
112 + color: 'gray'
109113 }
114 + }, [
115 + h('div', 'private: ['),
116 + map(msg.value.content.recps, id => (
117 + api.avatar_image_link('string' == typeof id ? id : id.link)
118 + )),
119 + h('div', ']'),
120 + ])
121 + }
122 +
123 + function message_content_mini (msg, sbot) {
124 + if (typeof msg.value.content === 'string') {
125 + var icon = api.emoji_url('lock')
126 + return icon
127 + ? h('img', {className: 'emoji', src: icon})
128 + : 'PRIVATE'
110129 }
111130 }
112-
113131 }
114132
modules_extra/channel.jsView
@@ -44,9 +44,9 @@
4444 var chan = msg.value.content.channel
4545 if (chan)
4646 return h('a', {
4747 href: '##'+chan,
48- order: 98
48 + style: { order: 98 },
4949 }, '#'+chan)
5050 }
5151
5252 function screen_view (path) {
modules_extra/raw.jsView
@@ -7,16 +7,16 @@
77 return function (msg) {
88 var tmp = h('div')
99 var el
1010 var pre
11- const symbol = '\u2699'
11 + const symbol = '\u2699' // gear ⚙
1212 var clicked = false
1313
1414 return h('a', {
1515 title: 'View raw data',
1616 style: {
1717 order: 99,
18- color: 'gray',
18 + color: '#a8a8a8',
1919 'font-size': '1rem',
2020 cursor: 'pointer',
2121 },
2222 onclick: function () {
package.jsonView
@@ -1,8 +1,8 @@
11 {
22 "name": "patchbay",
33 "description": "a pluggable patchwork",
4- "version": "6.7.3",
4 + "version": "6.7.4",
55 "homepage": "https://github.com/ssbc/patchbay",
66 "repository": {
77 "type": "git",
88 "url": "git://github.com/ssbc/patchbay.git"

Built with git-ssb-web