From 75da037656a64987d36d81a4c65f2ab4c4e96451 Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 6 Mar 2018 11:25:39 +0200 Subject: [PATCH] fix stream note --- application/Espo/Acl/Note.php | 45 +++++++++++++++++++ application/Espo/AclPortal/Note.php | 45 +++++++++++++++++++ client/src/views/stream/note.js | 3 ++ client/src/views/stream/notes/create.js | 2 +- .../src/views/stream/notes/email-received.js | 6 +-- client/src/views/stream/notes/email-sent.js | 7 ++- 6 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 application/Espo/Acl/Note.php create mode 100644 application/Espo/AclPortal/Note.php diff --git a/application/Espo/Acl/Note.php b/application/Espo/Acl/Note.php new file mode 100644 index 0000000000..a85b8dc716 --- /dev/null +++ b/application/Espo/Acl/Note.php @@ -0,0 +1,45 @@ +get('type') === 'Post' && $user->id === $entity->get('createdById')) { + return true; + } + return false; + } +} + diff --git a/application/Espo/AclPortal/Note.php b/application/Espo/AclPortal/Note.php new file mode 100644 index 0000000000..bde668d6ef --- /dev/null +++ b/application/Espo/AclPortal/Note.php @@ -0,0 +1,45 @@ +get('type') === 'Post' && $user->id === $entity->get('createdById')) { + return true; + } + return false; + } +} + diff --git a/client/src/views/stream/note.js b/client/src/views/stream/note.js index 5d5b59316d..f9bc8a5bb3 100644 --- a/client/src/views/stream/note.js +++ b/client/src/views/stream/note.js @@ -70,6 +70,9 @@ Espo.define('views/stream/note', 'view', function (Dep) { } } + if (this.getUser().isAdmin()) { + this.isRemovable = true; + } if (this.messageName && this.isThis) { this.messageName += 'This'; diff --git a/client/src/views/stream/notes/create.js b/client/src/views/stream/notes/create.js index a61316e605..a01dcf7dea 100644 --- a/client/src/views/stream/notes/create.js +++ b/client/src/views/stream/notes/create.js @@ -36,7 +36,7 @@ Espo.define('views/stream/notes/create', 'views/stream/note', function (Dep) { messageName: 'create', - isRemovable: true, + isRemovable: false, data: function () { return _.extend({ diff --git a/client/src/views/stream/notes/email-received.js b/client/src/views/stream/notes/email-received.js index cd6b3f704f..c9f0fe5ebe 100644 --- a/client/src/views/stream/notes/email-received.js +++ b/client/src/views/stream/notes/email-received.js @@ -26,13 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('Views.Stream.Notes.EmailReceived', 'Views.Stream.Note', function (Dep) { +Espo.define('views/stream/notes/email-received', 'views/stream/note', function (Dep) { return Dep.extend({ - template: 'stream.notes.email-received', + template: 'stream/notes/email-received', - isRemovable: true, + isRemovable: false, isSystemAvatar: true, diff --git a/client/src/views/stream/notes/email-sent.js b/client/src/views/stream/notes/email-sent.js index 90ad4d1a72..70ebadabda 100644 --- a/client/src/views/stream/notes/email-sent.js +++ b/client/src/views/stream/notes/email-sent.js @@ -26,13 +26,13 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('Views.Stream.Notes.EmailSent', 'Views.Stream.Note', function (Dep) { +Espo.define('views/stream/notes/email-sent', 'views/stream/note', function (Dep) { return Dep.extend({ - template: 'stream.notes.email-sent', + template: 'stream/notes/email-sent', - isRemovable: true, + isRemovable: false, data: function () { return _.extend({ @@ -80,4 +80,3 @@ Espo.define('Views.Stream.Notes.EmailSent', 'Views.Stream.Note', function (Dep) }); }); -