annotation: display dialog for conflicting comment modification
Signed-off-by: Pranam Lashkari <lpranam@collabora.com> Change-Id: Ie45aa11a0df506fdb8c9d0d78b186323ee3a4242
This commit is contained in:
parent
80aae586a2
commit
ccdf5a379f
2 changed files with 23 additions and 4 deletions
|
@ -1216,6 +1216,25 @@ export class CommentSection extends app.definitions.canvasSectionObject {
|
|||
|
||||
public onACKComment (obj: any): void {
|
||||
var id;
|
||||
const anyEdit = Comment.isAnyEdit();
|
||||
if (anyEdit && anyEdit.sectionProperties.data.id === obj.comment.id) {
|
||||
if (document.getElementById(this.map.uiManager.generateModalId('comments-update')))
|
||||
return;
|
||||
this.map.uiManager.showYesNoButton(
|
||||
'comments-update',
|
||||
_('Comments updated'),
|
||||
_('Another user has updated the comment. Would you like to overwrite those changes?'),
|
||||
_('Overwrite'),
|
||||
_('Update'),
|
||||
null,
|
||||
() => {
|
||||
this.clearAutoSaveStatus();
|
||||
anyEdit.onCancelClick(null);
|
||||
this.onACKComment(obj);
|
||||
}, false
|
||||
);
|
||||
return;
|
||||
}
|
||||
var changetrack = obj.redline ? true : false;
|
||||
var dataroot = changetrack ? 'redline' : 'comment';
|
||||
if (changetrack) {
|
||||
|
|
|
@ -1033,11 +1033,11 @@ export class Comment extends app.definitions.canvasSectionObject {
|
|||
(this.sectionProperties.nodeReply && this.sectionProperties.nodeReply.style.display !== 'none'));
|
||||
}
|
||||
|
||||
public static isAnyEdit (): boolean {
|
||||
public static isAnyEdit (): Comment {
|
||||
var section = app.sectionContainer && app.sectionContainer instanceof CanvasSectionContainer ?
|
||||
app.sectionContainer.getSectionWithName(L.CSections.CommentList.name) : null;
|
||||
if (!section) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
var commentList = section.sectionProperties.commentList;
|
||||
|
@ -1047,9 +1047,9 @@ export class Comment extends app.definitions.canvasSectionObject {
|
|||
if (!commentList[i].pendingInit &&
|
||||
((modifyNode && modifyNode.style.display !== 'none') ||
|
||||
(replyNode && replyNode.style.display !== 'none')))
|
||||
return true;
|
||||
return commentList[i];
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
|
Loading…
Reference in a new issue