git ssb

2+

mixmix / ticktack



Commit b361e2bf3aa5a852f1427695f6377cf100494224

disable attachments on private messages

Dominic Tarr committed on 8/18/2017, 4:48:03 AM
Parent: 689176df955de12578eefa69caa0c5d9fdb66d76

Files changed

message/html/compose.jschanged
message/html/compose.jsView
@@ -66,23 +66,30 @@
6666 placeholder
6767 })
6868 textArea.publish = publish // TODO: fix - clunky api for the keyboard shortcut to target
6969
70- var fileInput = api.blob.html.input(file => {
71- files.push(file)
72- filesById[file.link] = file
70+ var fileInput
71+ if(!meta.recps) {
72+ fileInput = api.blob.html.input(file => {
73+ files.push(file)
74+ filesById[file.link] = file
7375
74- var embed = file.type.match(/^image/) ? '!' : ''
75- var spacer = embed ? '\n' : ' '
76- var insertLink = spacer + embed + '[' + file.name + ']' + '(' + file.link + ')' + spacer
76+ var embed = file.type.match(/^image/) ? '!' : ''
77+ var spacer = embed ? '\n' : ' '
78+ var insertLink = spacer + embed + '[' + file.name + ']' + '(' + file.link + ')' + spacer
7779
78- var pos = textArea.selectionStart
79- textArea.value = textArea.value.slice(0, pos) + insertLink + textArea.value.slice(pos)
80+ var pos = textArea.selectionStart
81+ textArea.value = textArea.value.slice(0, pos) + insertLink + textArea.value.slice(pos)
8082
81- console.log('added:', file)
82- })
83+ console.log('added:', file)
84+ })
8385
84- fileInput.onclick = () => hasContent.set(true)
86+ fileInput.onclick = () => hasContent.set(true)
87+ }
88+ // if fileInput is null, send button moves to the left side
89+ // and we don't want that.
90+ else
91+ fileInput = h('span')
8592
8693 var publishBtn = h('Button -primary', { 'ev-click': publish }, strings.sendMessage)
8794
8895 var actions = h('section.actions', [
@@ -190,4 +197,6 @@
190197 }
191198 }
192199
193200
201+
202+

Built with git-ssb-web