fix stream attachments

This commit is contained in:
yuri
2018-07-16 10:51:55 +03:00
parent b92de17f72
commit ee640273a1
+3 -3
View File
@@ -105,7 +105,7 @@ Espo.define('views/stream/panel', ['views/record/panels/relationship', 'lib!Text
if ($.contains(this.$postContainer.get(0), e.target)) return;
if (this.$textarea.val() !== '') return;
var attachmentsIds = this.seed.get('attachmentsIds');
var attachmentsIds = this.seed.get('attachmentsIds') || [];
if (!attachmentsIds.length && !this.getView('attachments').isUploading) {
this.disablePostingMode();
}
@@ -363,7 +363,7 @@ Espo.define('views/stream/panel', ['views/record/panels/relationship', 'lib!Text
return;
}
if (message == '' && this.seed.get('attachmentsIds').length == 0) {
if (message == '' && (this.seed.get('attachmentsIds') || []).length == 0) {
this.notify('Post cannot be empty', 'error');
this.$textarea.prop('disabled', false);
return;
@@ -386,7 +386,7 @@ Espo.define('views/stream/panel', ['views/record/panels/relationship', 'lib!Text
}, this);
model.set('post', message);
model.set('attachmentsIds', Espo.Utils.clone(this.seed.get('attachmentsIds')));
model.set('attachmentsIds', Espo.Utils.clone(this.seed.get('attachmentsIds') || []));
model.set('type', 'Post');
model.set('isInternal', this.isInternalNoteMode);