From ef06bf432d8cfb8afbafeb14ecb7458e402d0371 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 10 Sep 2020 12:25:47 +0200 Subject: [PATCH] Enable settings page for non-admins Non-admins need to be able to update their telemetry opt-in preferences --- assets/src/dashboard/app/index.js | 4 +-- .../app/views/editorSettings/index.js | 28 +++++++++++-------- .../components/pageStructure/index.js | 9 ++---- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/assets/src/dashboard/app/index.js b/assets/src/dashboard/app/index.js index 684aa6ea3938..b4dfedaaaed9 100644 --- a/assets/src/dashboard/app/index.js +++ b/assets/src/dashboard/app/index.js @@ -65,9 +65,7 @@ const AppContent = () => { state: { currentPath }, } = useRouteHistory(); - const { capabilities: { canManageSettings } = {} } = useConfig(); - const enableSettingsView = - useFeature('enableSettingsView') && canManageSettings; + const enableSettingsView = useFeature('enableSettingsView'); useEffect(() => { const dynamicPageTitle = ROUTE_TITLES[currentPath] || ROUTE_TITLES.DEFAULT; diff --git a/assets/src/dashboard/app/views/editorSettings/index.js b/assets/src/dashboard/app/views/editorSettings/index.js index bb152db29b68..44f6007704a2 100644 --- a/assets/src/dashboard/app/views/editorSettings/index.js +++ b/assets/src/dashboard/app/views/editorSettings/index.js @@ -85,7 +85,7 @@ function EditorSettings() { ); const { - capabilities: { canUploadFiles } = {}, + capabilities: { canUploadFiles, canManageSettings } = {}, maxUpload, maxUploadFormatted, } = useConfig(); @@ -110,7 +110,9 @@ function EditorSettings() { */ useEffect(() => { - fetchSettings(); + if ( canManageSettings ) { + fetchSettings(); + } }, [fetchSettings]); useEffect(() => { @@ -263,18 +265,20 @@ function EditorSettings() {
- - + /> } + { canManageSettings && + + }