From 6fb88665bb7488e0bc31feca115e7c87c253503b Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 15 Apr 2015 10:05:08 +0300 Subject: [PATCH 1/2] messageId fix --- application/Espo/Core/Mail/Sender.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/Espo/Core/Mail/Sender.php b/application/Espo/Core/Mail/Sender.php index ee6ef3341b..9f5186cad9 100644 --- a/application/Espo/Core/Mail/Sender.php +++ b/application/Espo/Core/Mail/Sender.php @@ -307,7 +307,7 @@ class Sender $this->transport->send($message); - $email->set('messageId', $messageId); + $email->set('messageId', '<' . $messageId . '>'); $email->set('status', 'Sent'); $email->set('dateSent', date("Y-m-d H:i:s")); } catch (\Exception $e) { From 6db658c0b328f943515d1f7ae4ddb523547986ec Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 15 Apr 2015 10:47:03 +0300 Subject: [PATCH 2/2] fix follow button --- frontend/client/src/views/detail.js | 88 +++++++++++++++-------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/frontend/client/src/views/detail.js b/frontend/client/src/views/detail.js index bc1c08a61d..8cd1dbd547 100644 --- a/frontend/client/src/views/detail.js +++ b/frontend/client/src/views/detail.js @@ -45,26 +45,37 @@ Espo.define('Views.Detail', 'Views.Main', function (Dep) { }, addUnfollowButtonToMenu: function () { - this.menu.buttons.unshift({ - name: 'unfollow', - label: 'Followed', - style: 'success', - action: 'unfollow' - }); - var index = -1; this.menu.buttons.forEach(function (data, i) { if (data.name == 'follow') { - var index = i; + index = i; return; } }, this); if (~index) { this.menu.buttons.splice(index, 1); } + + this.menu.buttons.unshift({ + name: 'unfollow', + label: 'Followed', + style: 'success', + action: 'unfollow' + }); }, addFollowButtonToMenu: function () { + var index = -1; + this.menu.buttons.forEach(function (data, i) { + if (data.name == 'unfollow') { + index = i; + return; + } + }, this); + if (~index) { + this.menu.buttons.splice(index, 1); + } + this.menu.buttons.unshift({ name: 'follow', label: 'Follow', @@ -72,17 +83,6 @@ Espo.define('Views.Detail', 'Views.Main', function (Dep) { icon: 'glyphicon glyphicon-share-alt', action: 'follow' }); - - var index = -1; - this.menu.buttons.forEach(function (data, i) { - if (data.name == 'unfollow') { - var index = i; - return; - } - }, this); - if (~index) { - this.menu.buttons.splice(index, 1); - } }, setup: function () { @@ -90,39 +90,37 @@ Espo.define('Views.Detail', 'Views.Main', function (Dep) { if (this.getMetadata().get('scopes.' + this.scope + '.stream')) { if (this.model.has('isFollowed')) { - if (this.model.get('isFollowed')) { - this.addUnfollowButtonToMenu(); - } else { - this.addFollowButtonToMenu(); - } + this.handleFollowButton(); } else { this.once('after:render', function () { - var proceed = function () { - if (this.model.get('isFollowed')) { - this.addUnfollowButton(); - this.addUnfollowButtonToMenu(); - } else { - this.addFollowButton(); - this.addFollowButtonToMenu(); - - } - }.bind(this); - if (this.model.has('isFollowed')) { - proceed(); + this.handleFollowButton(); } else { this.listenToOnce(this.model, 'sync', function () { if (this.model.has('isFollowed')) { - proceed(); + this.handleFollowButton(); } - }.bind(this)); + }, this); } - }, this); } } }, + handleFollowButton: function () { + if (this.model.get('isFollowed')) { + if (this.isRendered()) { + this.addUnfollowButton(); + } + this.addUnfollowButtonToMenu(); + } else { + if (this.isRendered()) { + this.addFollowButton(); + } + this.addFollowButtonToMenu(); + } + }, + addFollowButton: function () { $el = $('