Revert "annotation: reset comment id if autosave is cancelled"

This reverts commit 3c1ac04b0e.

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I842f8fc7feac01685785af72929974fc4fa397af
This commit is contained in:
Pranam Lashkari 2023-12-01 05:01:56 +05:30 committed by Szymon Kłos
parent bdbe2dfa51
commit 8a592db923
2 changed files with 3 additions and 4 deletions

View file

@ -1169,8 +1169,9 @@ export class CommentSection extends CanvasSectionObject {
}
if (action === 'Add') {
if (app.view.commentAutoSave) {
// preserve original Id, can be used in case of reply to find parent comment, or revert the id in case comment insertion is cancelled
app.view.commentAutoSave.sectionProperties.data.oldId = app.view.commentAutoSave.sectionProperties.data.id;
// preserve the id of the root comment and use it when reply button is clicked
if (app.view.commentAutoSave.sectionProperties.data.reply)
app.view.commentAutoSave.sectionProperties.data.oldId = app.view.commentAutoSave.sectionProperties.data.id;
app.view.commentAutoSave.sectionProperties.data.id = obj.comment.id;
app.view.commentAutoSave.sectionProperties.autoSave.innerText = _('Autosaved') ;
app.view.commentAutoSave = null;

View file

@ -826,8 +826,6 @@ export class Comment extends CanvasSectionObject {
return;
if (app.view.commentAutoAdded) {
this.sectionProperties.commentListSection.remove(this.sectionProperties.data.id);
app.view.commentAutoAdded = false;
this.sectionProperties.data.id = this.sectionProperties.data.oldId;
if (this.sectionProperties.commentListSection.sectionProperties.selectedComment.sectionProperties.container.classList.contains('reply-annotation-container')) {
this.show();
return;