Merge pull request #211 from ONLYOFFICE/feature/comment-mentions

Feature/comment mentions
This commit is contained in:
Julia Radzhabova 2019-07-16 16:12:15 +03:00 committed by GitHub
commit 13fe6a52ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 8 deletions

View file

@ -130,6 +130,7 @@ define([
});
Common.NotificationCenter.on('comments:updatefilter', _.bind(this.onUpdateFilter, this));
Common.NotificationCenter.on('comments:showaction', _.bind(this.onShowAction, this));
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
Common.NotificationCenter.on('layout:changed', function(area){
Common.Utils.asyncCall(function(e) {
@ -281,7 +282,7 @@ define([
return false;
},
onShowComment: function (id, selected) {
var comment = this.findComment(id);
var comment = (typeof id == Object) ? id : this.findComment(id);
if (comment) {
if (null !== comment.get('quote')) {
if (this.api) {
@ -495,7 +496,7 @@ define([
ascComment.asc_addReply(addReply);
me.api.asc_changeComment(id, ascComment);
me.mode && me.mode.canRequestUsers && me.view.pickEMail(id, replyVal);
me.mode && me.mode.canRequestUsers && me.view.pickEMail(ascComment.asc_getGuid(), replyVal);
return true;
}
@ -1193,6 +1194,7 @@ define([
groupname = id.substr(0, id.lastIndexOf('_')+1).match(/^(doc|sheet[0-9_]+)_/);
var comment = new Common.Models.Comment({
uid : id,
guid : data.asc_getGuid(),
userid : data.asc_getUserId(),
username : data.asc_getUserName(),
usercolor : (user) ? user.get('color') : null,
@ -1346,9 +1348,9 @@ define([
if (!_.isUndefined(comment.asc_putDocumentFlag))
comment.asc_putDocumentFlag(false);
var commentId = this.api.asc_addComment(comment);
this.api.asc_addComment(comment);
this.view.showEditContainer(false);
this.mode && this.mode.canRequestUsers && this.view.pickEMail(commentId, commentVal);
this.mode && this.mode.canRequestUsers && this.view.pickEMail(comment.asc_getGuid(), commentVal);
if (!_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)) {
this.api.asc_SetDocumentPlaceChangedEnabled(false);
}
@ -1521,6 +1523,11 @@ define([
clearCollections: function() {
this.collection.reset();
this.groupCollection = [];
},
onShowAction: function(id, selected) {
var comment = this.collection.findWhere({guid: id});
comment && this.onShowComment(comment, selected);
}
}, Common.Controllers.Comments || {}));

View file

@ -53,6 +53,7 @@ define([
Common.Models.Comment = Backbone.Model.extend({
defaults: {
uid : 0, // asc
guid : '',
userid : 0,
username : 'Guest',
usercolor : null,

View file

@ -705,7 +705,7 @@ define([
arr = _.map(arr, function(str){
return str.slice(1, str.length);
});
Common.Gateway.requestSendNotify({
(arr.length>0) && Common.Gateway.requestSendNotify({
emails: arr,
actionId: commentId, // comment id
actionLink: {

View file

@ -1047,7 +1047,7 @@ define([
onDocumentReady: function() {
if (this.editorConfig.actionLink && this.editorConfig.actionLink.action && this.editorConfig.actionLink.action.type == 'comment') {
this.contComments.getView().fireEvent('comment:show', [this.editorConfig.actionLink.action.data, false]);
Common.NotificationCenter.trigger('comments:showaction', this.editorConfig.actionLink.action.data, false);
}
},

View file

@ -792,7 +792,7 @@ define([
onDocumentReady: function() {
if (this.editorConfig.actionLink && this.editorConfig.actionLink.action && this.editorConfig.actionLink.action.type == 'comment') {
this.getApplication().getController('Common.Controllers.Comments').getView().fireEvent('comment:show', [this.editorConfig.actionLink.action.data, false]);
Common.NotificationCenter.trigger('comments:showaction', this.editorConfig.actionLink.action.data, false);
}
},

View file

@ -803,7 +803,7 @@ define([
onDocumentReady: function() {
if (this.editorConfig.actionLink && this.editorConfig.actionLink.action && this.editorConfig.actionLink.action.type == 'comment') {
this.getApplication().getController('Common.Controllers.Comments').getView().fireEvent('comment:show', [this.editorConfig.actionLink.action.data, false]);
Common.NotificationCenter.trigger('comments:showaction', this.editorConfig.actionLink.action.data, false);
}
},