Reintroduce single attachment limit
This commit is contained in:
parent
985b1d6aa6
commit
f9ea7be61f
3 changed files with 35 additions and 6 deletions
|
@ -551,6 +551,11 @@
|
||||||
"description":
|
"description":
|
||||||
"Shown in toast when user attempts to send .exe file, for example"
|
"Shown in toast when user attempts to send .exe file, for example"
|
||||||
},
|
},
|
||||||
|
"maxOneAttachmentToast": {
|
||||||
|
"message": "The limit is one attachment per message.",
|
||||||
|
"description":
|
||||||
|
"An error popup when the user has attempted to add an attachment"
|
||||||
|
},
|
||||||
"oneNonImageAtATimeToast": {
|
"oneNonImageAtATimeToast": {
|
||||||
"message":
|
"message":
|
||||||
"When including a non-image attachment, the limit is one attachment per message.",
|
"When including a non-image attachment, the limit is one attachment per message.",
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
Whisper.MaxAttachmentsToast = Whisper.ToastView.extend({
|
Whisper.MaxAttachmentsToast = Whisper.ToastView.extend({
|
||||||
template: i18n('maximumAttachments'),
|
template: i18n('maximumAttachments'),
|
||||||
});
|
});
|
||||||
|
Whisper.MaxOneAttachmentToast = Whisper.ToastView.extend({
|
||||||
|
template: i18n('maxOneAttachmentToast'),
|
||||||
|
});
|
||||||
|
|
||||||
Whisper.FileInputView = Backbone.View.extend({
|
Whisper.FileInputView = Backbone.View.extend({
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
|
@ -249,6 +252,12 @@
|
||||||
toast.render();
|
toast.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showMaxOneAttachmentError() {
|
||||||
|
const toast = new Whisper.MaxOneAttachmentToast();
|
||||||
|
toast.$el.insertAfter(this.$el);
|
||||||
|
toast.render();
|
||||||
|
},
|
||||||
|
|
||||||
// Housekeeping
|
// Housekeeping
|
||||||
|
|
||||||
addAttachment(attachment) {
|
addAttachment(attachment) {
|
||||||
|
@ -268,6 +277,12 @@
|
||||||
const fileName = file.name;
|
const fileName = file.name;
|
||||||
const contentType = file.type;
|
const contentType = file.type;
|
||||||
|
|
||||||
|
// TODO: remove this when clients are ready to remove multiple image attachments
|
||||||
|
if (this.attachments.length > 0) {
|
||||||
|
this.showMaxOneAttachmentError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (window.Signal.Util.isFileDangerous(fileName)) {
|
if (window.Signal.Util.isFileDangerous(fileName)) {
|
||||||
this.showDangerousError();
|
this.showDangerousError();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1226,7 +1226,7 @@
|
||||||
"rule": "jQuery-insertAfter(",
|
"rule": "jQuery-insertAfter(",
|
||||||
"path": "js/views/file_input_view.js",
|
"path": "js/views/file_input_view.js",
|
||||||
"line": " toast.$el.insertAfter(this.$el);",
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
"lineNumber": 216,
|
"lineNumber": 219,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-12-15T03:04:48.403Z",
|
"updated": "2018-12-15T03:04:48.403Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -1235,7 +1235,7 @@
|
||||||
"rule": "jQuery-insertAfter(",
|
"rule": "jQuery-insertAfter(",
|
||||||
"path": "js/views/file_input_view.js",
|
"path": "js/views/file_input_view.js",
|
||||||
"line": " toast.$el.insertAfter(this.$el);",
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
"lineNumber": 222,
|
"lineNumber": 225,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-12-15T03:04:48.403Z",
|
"updated": "2018-12-15T03:04:48.403Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -1244,7 +1244,7 @@
|
||||||
"rule": "jQuery-insertAfter(",
|
"rule": "jQuery-insertAfter(",
|
||||||
"path": "js/views/file_input_view.js",
|
"path": "js/views/file_input_view.js",
|
||||||
"line": " toast.$el.insertAfter(this.$el);",
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
"lineNumber": 230,
|
"lineNumber": 233,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-12-15T03:04:48.403Z",
|
"updated": "2018-12-15T03:04:48.403Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -1253,7 +1253,7 @@
|
||||||
"rule": "jQuery-insertAfter(",
|
"rule": "jQuery-insertAfter(",
|
||||||
"path": "js/views/file_input_view.js",
|
"path": "js/views/file_input_view.js",
|
||||||
"line": " toast.$el.insertAfter(this.$el);",
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
"lineNumber": 236,
|
"lineNumber": 239,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-12-15T03:04:48.403Z",
|
"updated": "2018-12-15T03:04:48.403Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -1262,7 +1262,7 @@
|
||||||
"rule": "jQuery-insertAfter(",
|
"rule": "jQuery-insertAfter(",
|
||||||
"path": "js/views/file_input_view.js",
|
"path": "js/views/file_input_view.js",
|
||||||
"line": " toast.$el.insertAfter(this.$el);",
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
"lineNumber": 242,
|
"lineNumber": 245,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-12-15T03:04:48.403Z",
|
"updated": "2018-12-15T03:04:48.403Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
@ -1271,7 +1271,16 @@
|
||||||
"rule": "jQuery-insertAfter(",
|
"rule": "jQuery-insertAfter(",
|
||||||
"path": "js/views/file_input_view.js",
|
"path": "js/views/file_input_view.js",
|
||||||
"line": " toast.$el.insertAfter(this.$el);",
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
"lineNumber": 248,
|
"lineNumber": 251,
|
||||||
|
"reasonCategory": "usageTrusted",
|
||||||
|
"updated": "2019-01-04T20:24:04.674Z",
|
||||||
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-insertAfter(",
|
||||||
|
"path": "js/views/file_input_view.js",
|
||||||
|
"line": " toast.$el.insertAfter(this.$el);",
|
||||||
|
"lineNumber": 257,
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2018-12-15T03:04:48.403Z",
|
"updated": "2018-12-15T03:04:48.403Z",
|
||||||
"reasonDetail": "Protected from arbitrary input"
|
"reasonDetail": "Protected from arbitrary input"
|
||||||
|
|
Loading…
Add table
Reference in a new issue