From ee640273a17a252ca889e14799ac8d34ff7dcaea Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 16 Jul 2018 10:51:55 +0300 Subject: [PATCH] fix stream attachments --- client/src/views/stream/panel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/views/stream/panel.js b/client/src/views/stream/panel.js index 091267954f..917d9cec50 100644 --- a/client/src/views/stream/panel.js +++ b/client/src/views/stream/panel.js @@ -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);