From 3d085ff2d7de9e7a4a9aec5963df2541a368eecd Mon Sep 17 00:00:00 2001 From: George Gevoian Date: Fri, 27 Aug 2021 11:10:30 -0700 Subject: [PATCH] (core) Fix warning bug in Save Copy dialog Summary: The warning about workspace write access would still be shown if a user picked a workspace they had write access to, and cleared the Name field in the Save Copy dialog. This fixes the condition for showing the warning to not show it in this case, and adds a placeholder to the Name field when it is blank. Test Plan: Browser test. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D3002 --- app/client/ui/MakeCopyMenu.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/client/ui/MakeCopyMenu.ts b/app/client/ui/MakeCopyMenu.ts index 9bb30d5a..a9ccd328 100644 --- a/app/client/ui/MakeCopyMenu.ts +++ b/app/client/ui/MakeCopyMenu.ts @@ -163,7 +163,7 @@ class SaveCopyModal extends Disposable { return [ cssField( cssLabel("Name"), - input(this._destName, {onInput: true}, dom.cls(cssInput.className), + input(this._destName, {onInput: true}, {placeholder: 'Enter document name'}, dom.cls(cssInput.className), // modal dialog grabs focus after 10ms delay; so to focus this input, wait a bit longer // (see the TODO in app/client/ui2018/modals.ts about weasel.js and focus). (elem) => { setTimeout(() => { elem.focus(); }, 20); }, @@ -204,10 +204,11 @@ class SaveCopyModal extends Disposable { ), testId('copy-dest-workspace'), ), - wss ? dom.maybe(this._saveDisabled, () => - cssWarningText("You do not have write access to the selected workspace", - testId('copy-warning') - ) + wss ? dom.domComputed(this._destWS, (destWs) => + destWs && !roles.canEdit(destWs.access) ? + cssWarningText("You do not have write access to the selected workspace", + testId('copy-warning') + ) : null ) : null ] ),