From fc56cc7231bc6b683d2f6fb85f0e1c4a446d4ed8 Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Thu, 4 Feb 2021 14:28:18 -0500 Subject: [PATCH] (core) tweak embedding to play well with forking Summary: In the transition from a "pre-fork" to fork, when embedded, the fork ends up being read-only and changes fail. This commit avoids applying the read-only default to forks. If a user actually wants to specifically embed a fork as read-only, they can still do so, by explicitly adding `/m/view`. Test Plan: added test Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2723 --- app/common/gristUrls.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/common/gristUrls.ts b/app/common/gristUrls.ts index a9beb492..b75e7ba7 100644 --- a/app/common/gristUrls.ts +++ b/app/common/gristUrls.ts @@ -257,8 +257,8 @@ export function decodeUrl(gristConfig: Partial, location: Locat } if (sp.has('embed')) { const embed = state.params!.embed = isAffirmative(sp.get('embed')); - // Turn view mode on if no mode has been specified. - if (embed && !state.mode) { state.mode = 'view'; } + // Turn view mode on if no mode has been specified, and not a fork. + if (embed && !state.mode && !state.fork) { state.mode = 'view'; } // Turn on light style if no style has been specified. if (embed && !state.params!.style) { state.params!.style = 'light'; } }