[DE] Added option "customization->commentAuthorOnly". If "true" - user can edit only comments that he created, otherwise he can edit all comments.

This commit is contained in:
Julia Radzhabova 2017-04-11 16:43:31 +03:00
parent c39e55d631
commit 882a78c0c6
6 changed files with 26 additions and 11 deletions

View file

@ -114,7 +114,8 @@
toolbar: true,
header: true,
autosave: true,
forcesave: false
forcesave: false,
commentAuthorOnly: false
},
plugins: {
autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}',

View file

@ -698,7 +698,8 @@ define([
editText : false,
editTextInPopover : false,
showReplyInPopover : false,
scope : t.view
scope : t.view,
editable : t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)
}));
}
@ -1047,7 +1048,8 @@ define([
editTextInPopover : (this.editPopover ? true : false),
showReplyInPopover : false,
hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false),
scope : this.view
scope : this.view,
editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)
});
if (comment) {
var replies = this.readSDKReplies(data);
@ -1078,7 +1080,8 @@ define([
editText : false,
editTextInPopover : false,
showReplyInPopover : false,
scope : this.view
scope : this.view,
editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)
}));
}
@ -1229,7 +1232,7 @@ define([
for (i = 0; i < comments.length; ++i) {
comment = this.findComment(comments[i].asc_getId());
if (comment) {
comment.set('editTextInPopover', true);
comment.set('editTextInPopover', t.mode.canEditComments);// dont't edit comment when customization->commentAuthorOnly is true
comment.set('hint', false);
this.popoverComments.push(comment);
}

View file

@ -75,7 +75,8 @@ define([
scope : null,
hide : false,
hint : false,
dummy : undefined
dummy : undefined,
editable : true
}
});
Common.Models.Reply = Backbone.Model.extend({
@ -89,7 +90,8 @@ define([
id : Common.UI.getId(), // internal
editText : false,
editTextInPopover : false,
scope : null
scope : null,
editable : true
}
});
});

View file

@ -29,7 +29,9 @@
<% if (!item.get("editText")) { %>
<div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
<div class="btns-reply-ct">
<% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<% } %>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
</div>
<% } else { %>
@ -57,7 +59,9 @@
<% if (!editText && !lock) { %>
<div class="edit-ct">
<% if (editable) { %>
<div class="btn-edit img-commonctrl"></div>
<% } %>
<div class="btn-delete img-commonctrl"></div>
<% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>

View file

@ -30,7 +30,9 @@
<div class="user-message"><%=scope.pickLink(item.get("reply"))%></div>
<% if (!hint) { %>
<div class="btns-reply-ct">
<% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<%}%>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
</div>
<%}%>
@ -60,7 +62,9 @@
<% if (!editTextInPopover && !lock && !hint) { %>
<div class="edit-ct">
<% if (editable) { %>
<div class="btn-edit img-commonctrl"></div>
<% } %>
<div class="btn-delete img-commonctrl"></div>
<% if (resolved) { %>
<div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>

View file

@ -1024,6 +1024,7 @@ define([
this.appOptions.buildVersion = params.asc_getBuildVersion();
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly);
if ( this.appOptions.isLightVersion ) {
this.appOptions.canUseHistory =