From 86fd93ab0e0f3fa36b3305185c85f0933b13e3e2 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 12 Jul 2021 19:30:57 -0300 Subject: [PATCH 1/6] fix: prevent restoring version if note is locked --- .../javascripts/directives/views/revisionPreviewModal.ts | 5 +++++ app/assets/javascripts/strings.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/app/assets/javascripts/directives/views/revisionPreviewModal.ts b/app/assets/javascripts/directives/views/revisionPreviewModal.ts index 3332fbada..36768d61d 100644 --- a/app/assets/javascripts/directives/views/revisionPreviewModal.ts +++ b/app/assets/javascripts/directives/views/revisionPreviewModal.ts @@ -11,6 +11,7 @@ import { import template from '%/directives/revision-preview-modal.pug'; import { PayloadContent } from '@standardnotes/snjs'; import { confirmDialog } from '@/services/alertService'; +import { STRING_RESTORE_LOCKED_ATTEMPT } from '@/strings'; interface RevisionPreviewScope { uuid: string @@ -108,6 +109,10 @@ class RevisionPreviewModalCtrl extends PureViewCtrl implements RevisionPreviewSc }; if (!asCopy) { + if (this.originalNote.locked) { + this.application.alertService.alert(STRING_RESTORE_LOCKED_ATTEMPT); + return; + } confirmDialog({ text: "Are you sure you want to replace the current note's contents with what you see in this preview?", confirmButtonStyle: "danger" diff --git a/app/assets/javascripts/strings.ts b/app/assets/javascripts/strings.ts index 3041fa42b..05f540306 100644 --- a/app/assets/javascripts/strings.ts +++ b/app/assets/javascripts/strings.ts @@ -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."; export const STRING_EDIT_LOCKED_ATTEMPT = "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) { return permanently ? `Are you sure you want to permanently delete ${title}?` From 0e67f782596e8b125e165569ba78e625dbf52bf0 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 13 Jul 2021 09:52:36 -0300 Subject: [PATCH 2/6] fix: typo --- app/assets/javascripts/strings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/strings.ts b/app/assets/javascripts/strings.ts index 05f540306..85f835c49 100644 --- a/app/assets/javascripts/strings.ts +++ b/app/assets/javascripts/strings.ts @@ -43,7 +43,7 @@ export const STRING_DELETE_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."; 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." + "This note has editing disabled. If you'd like to restore a different version of it, enable editing, and try again." export function StringDeleteNote(title: string, permanently: boolean) { return permanently ? `Are you sure you want to permanently delete ${title}?` From b1aeaeac41dd0c1d3bccc579fdea16079cd0594c Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 13 Jul 2021 19:23:14 -0300 Subject: [PATCH 3/6] chore(version-snjs): 2.7.18 --- .env.sample | 4 +--- README.md | 5 +---- app/assets/javascripts/app.ts | 3 --- app/assets/javascripts/startApplication.ts | 1 - app/assets/javascripts/ui_models/application.ts | 2 -- app/assets/javascripts/ui_models/application_group.ts | 2 -- app/views/application/app.html.erb | 1 - index.html | 4 +--- package.json | 2 +- yarn.lock | 8 ++++---- 10 files changed, 8 insertions(+), 24 deletions(-) diff --git a/.env.sample b/.env.sample index 66af6248e..c7ad4a0b3 100644 --- a/.env.sample +++ b/.env.sample @@ -10,11 +10,9 @@ APP_HOST=http://localhost:3001 EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html SF_DEFAULT_SERVER=http://localhost:3000 -SF_NEXT_VERSION_SERVER=http://localhost:3000 # Development options -DEV_DEFAULT_SYNC_SERVER=https://sync.standardnotes.org -DEV_NEXT_VERSION_SYNC_SERVER=https://api.standardnotes.com +DEV_DEFAULT_SYNC_SERVER=https://api.standardnotes.com DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html ENABLE_UNFINISHED_FEATURES=false diff --git a/README.md b/README.md index fd153f659..df0f90026 100644 --- a/README.md +++ b/README.md @@ -107,13 +107,10 @@ The web app makes use of two optional native extensions, which, when running the EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html ``` -You can also set the `SF_DEFAULT_SERVER` and `SF_NEXT_VERSION_SERVER` environment variables to set the default servers for login and registration. - -> **Note:** SF_NEXT_VERSION_SERVER can point to the same server. It is used for gradual upgrade of API versions. +You can also set the `SF_DEFAULT_SERVER` environment variable to set the default server for login and registration. ``` SF_DEFAULT_SERVER=https://sync.myserver -SF_NEXT_VERSION_SERVER=https://sync.myserver ``` --- diff --git a/app/assets/javascripts/app.ts b/app/assets/javascripts/app.ts index a4969b733..d354335b7 100644 --- a/app/assets/javascripts/app.ts +++ b/app/assets/javascripts/app.ts @@ -91,7 +91,6 @@ function reloadHiddenFirefoxTab(): boolean { const startApplication: StartApplication = async function startApplication( defaultSyncServerHost: string, bridge: Bridge, - nextVersionSyncServerHost: string ) { if (reloadHiddenFirefoxTab()) { return; @@ -108,7 +107,6 @@ const startApplication: StartApplication = async function startApplication( .config(configRoutes) .constant('bridge', bridge) .constant('defaultSyncServerHost', defaultSyncServerHost) - .constant('nextVersionSyncServerHost', nextVersionSyncServerHost) .constant('appVersion', bridge.appVersion); // Controllers @@ -195,7 +193,6 @@ if (__WEB__) { startApplication( (window as any)._default_sync_server, new BrowserBridge(__VERSION__), - (window as any)._next_version_sync_server ); } else { (window as any).startApplication = startApplication; diff --git a/app/assets/javascripts/startApplication.ts b/app/assets/javascripts/startApplication.ts index 96df7f53b..b7fdf2580 100644 --- a/app/assets/javascripts/startApplication.ts +++ b/app/assets/javascripts/startApplication.ts @@ -3,5 +3,4 @@ import { Bridge } from "./services/bridge"; export type StartApplication = ( defaultSyncServerHost: string, bridge: Bridge, - nextVersionSyncServerHost: string ) => Promise; diff --git a/app/assets/javascripts/ui_models/application.ts b/app/assets/javascripts/ui_models/application.ts index 80080ccd2..2226284f9 100644 --- a/app/assets/javascripts/ui_models/application.ts +++ b/app/assets/javascripts/ui_models/application.ts @@ -53,7 +53,6 @@ export class WebApplication extends SNApplication { scope: angular.IScope, defaultSyncServerHost: string, public bridge: Bridge, - nextVersionSyncServerHost: string, ) { super( bridge.environment, @@ -64,7 +63,6 @@ export class WebApplication extends SNApplication { identifier, [], defaultSyncServerHost, - nextVersionSyncServerHost, ); this.$compile = $compile; this.scope = scope; diff --git a/app/assets/javascripts/ui_models/application_group.ts b/app/assets/javascripts/ui_models/application_group.ts index 05ede54a9..0fd5252de 100644 --- a/app/assets/javascripts/ui_models/application_group.ts +++ b/app/assets/javascripts/ui_models/application_group.ts @@ -29,7 +29,6 @@ export class ApplicationGroup extends SNApplicationGroup { $timeout: ng.ITimeoutService, private defaultSyncServerHost: string, private bridge: Bridge, - private nextVersionSyncServerHost: string, ) { super(new WebDeviceInterface($timeout, bridge)); this.$compile = $compile; @@ -64,7 +63,6 @@ export class ApplicationGroup extends SNApplicationGroup { scope, this.defaultSyncServerHost, this.bridge, - this.nextVersionSyncServerHost, ); const appState = new AppState( this.$rootScope, diff --git a/app/views/application/app.html.erb b/app/views/application/app.html.erb index 24bda6878..0cd8b0d88 100644 --- a/app/views/application/app.html.erb +++ b/app/views/application/app.html.erb @@ -30,7 +30,6 @@