diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index 115657f63..2203d87fb 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -406,9 +406,11 @@ define([ reply = null, addReply = null, ascComment = buildCommentData(), // new asc_CCommentData(null), - comment = t.findComment(id); + comment = t.findComment(id), + oldCommentVal = ''; if (comment && ascComment) { + oldCommentVal = comment.get('comment'); ascComment.asc_putText(commentVal); ascComment.asc_putQuoteText(comment.get('quote')); ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time')))); @@ -452,6 +454,7 @@ define([ } t.api.asc_changeComment(id, ascComment); + t.mode && t.mode.canRequestSendNotify && t.view.pickEMail(ascComment.asc_getGuid(), commentVal, oldCommentVal); return true; } @@ -465,7 +468,8 @@ define([ reply = null, addReply = null, ascComment = buildCommentData(), // new asc_CCommentData(null), - comment = me.findComment(id); + comment = me.findComment(id), + oldReplyVal = ''; if (ascComment && comment) { ascComment.asc_putText(comment.get('comment')); @@ -489,6 +493,7 @@ define([ addReply = buildCommentData(); // new asc_CCommentData(); if (addReply) { if (reply.get('id') === replyId && !_.isUndefined(replyVal)) { + oldReplyVal = reply.get('reply'); addReply.asc_putText(replyVal); addReply.asc_putUserId(me.currentUserId); addReply.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); @@ -508,7 +513,7 @@ define([ } me.api.asc_changeComment(id, ascComment); - + me.mode && me.mode.canRequestSendNotify && me.view.pickEMail(ascComment.asc_getGuid(), replyVal, oldReplyVal); return true; } } diff --git a/apps/common/main/lib/view/Comments.js b/apps/common/main/lib/view/Comments.js index 21732dd11..879779f17 100644 --- a/apps/common/main/lib/view/Comments.js +++ b/apps/common/main/lib/view/Comments.js @@ -806,11 +806,19 @@ define([ return str_res; }, - pickEMail: function (commentId, message) { + pickEMail: function (commentId, message, oldMessage) { + var old_arr = []; + if (oldMessage) { + old_arr = Common.Utils.String.htmlEncode(oldMessage).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._-]+\.[A-Z]+\b/gi); + old_arr = _.map(old_arr, function(str){ + return str.slice(1, str.length); + }); + } var arr = Common.Utils.String.htmlEncode(message).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._-]+\.[A-Z]+\b/gi); arr = _.map(arr, function(str){ return str.slice(1, str.length); }); + arr = _.difference(arr, old_arr); (arr.length>0) && Common.Gateway.requestSendNotify({ emails: arr, actionId: commentId, // comment id