Fix Bug 58931

This commit is contained in:
Julia Radzhabova 2022-10-27 12:52:50 +03:00
parent 1c66765645
commit 85364ac614
2 changed files with 17 additions and 4 deletions

View file

@ -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;
}
}

View file

@ -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