fix: prevent restoring version if note is locked
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
import template from '%/directives/revision-preview-modal.pug';
|
import template from '%/directives/revision-preview-modal.pug';
|
||||||
import { PayloadContent } from '@standardnotes/snjs';
|
import { PayloadContent } from '@standardnotes/snjs';
|
||||||
import { confirmDialog } from '@/services/alertService';
|
import { confirmDialog } from '@/services/alertService';
|
||||||
|
import { STRING_RESTORE_LOCKED_ATTEMPT } from '@/strings';
|
||||||
|
|
||||||
interface RevisionPreviewScope {
|
interface RevisionPreviewScope {
|
||||||
uuid: string
|
uuid: string
|
||||||
@@ -108,6 +109,10 @@ class RevisionPreviewModalCtrl extends PureViewCtrl implements RevisionPreviewSc
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!asCopy) {
|
if (!asCopy) {
|
||||||
|
if (this.originalNote.locked) {
|
||||||
|
this.application.alertService.alert(STRING_RESTORE_LOCKED_ATTEMPT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
confirmDialog({
|
confirmDialog({
|
||||||
text: "Are you sure you want to replace the current note's contents with what you see in this preview?",
|
text: "Are you sure you want to replace the current note's contents with what you see in this preview?",
|
||||||
confirmButtonStyle: "danger"
|
confirmButtonStyle: "danger"
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export const STRING_DELETE_LOCKED_ATTEMPT =
|
|||||||
"This note had editing disabled. If you'd like to delete it, enable editing, and try again.";
|
"This note had editing disabled. If you'd like to delete it, enable editing, and try again.";
|
||||||
export const STRING_EDIT_LOCKED_ATTEMPT =
|
export const STRING_EDIT_LOCKED_ATTEMPT =
|
||||||
"This note has editing disabled. If you'd like to edit its options, enable editing, and try again.";
|
"This note has editing disabled. If you'd like to edit its options, enable editing, and try again.";
|
||||||
|
export const STRING_RESTORE_LOCKED_ATTEMPT =
|
||||||
|
"This note has editing disabled. If you'd like to restore a different version if it, enable editing, and try again."
|
||||||
export function StringDeleteNote(title: string, permanently: boolean) {
|
export function StringDeleteNote(title: string, permanently: boolean) {
|
||||||
return permanently
|
return permanently
|
||||||
? `Are you sure you want to permanently delete ${title}?`
|
? `Are you sure you want to permanently delete ${title}?`
|
||||||
|
|||||||
Reference in New Issue
Block a user