Commit b361e2bf3aa5a852f1427695f6377cf100494224
disable attachments on private messages
Dominic Tarr committed on 8/18/2017, 4:48:03 AMParent: 689176df955de12578eefa69caa0c5d9fdb66d76
Files changed
message/html/compose.js | changed |
message/html/compose.js | ||
---|---|---|
@@ -66,23 +66,30 @@ | ||
66 | 66 | placeholder |
67 | 67 | }) |
68 | 68 | textArea.publish = publish // TODO: fix - clunky api for the keyboard shortcut to target |
69 | 69 | |
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 | |
73 | 75 | |
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 | |
77 | 79 | |
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) | |
80 | 82 | |
81 | - console.log('added:', file) | |
82 | - }) | |
83 | + console.log('added:', file) | |
84 | + }) | |
83 | 85 | |
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') | |
85 | 92 | |
86 | 93 | var publishBtn = h('Button -primary', { 'ev-click': publish }, strings.sendMessage) |
87 | 94 | |
88 | 95 | var actions = h('section.actions', [ |
@@ -190,4 +197,6 @@ | ||
190 | 197 | } |
191 | 198 | } |
192 | 199 | |
193 | 200 | |
201 | + | |
202 | + |
Built with git-ssb-web