From 0411872eb158e5c36bb27fd7c9072559ae528485 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 2 Oct 2024 15:17:07 +0200 Subject: [PATCH] Disable storage dashboard button for anon users Should largely avoid https://sentry.galaxyproject.org/share/issue/79354f243bd44cbf833255e27d6dd8fa/: ``` Error: API authentication required for this request at rethrowSimple(webpack://@galaxyproject/galaxy-client/./src/utils/simple-error.ts:24:11) at (webpack://@galaxyproject/galaxy-client/./src/api/schema/fetcher.ts:19:9) at Generator.throw() at rejected(webpack://@galaxyproject/galaxy-client/./src/api/schema/fetcher.ts:5:64) ``` Note that the stack trace isn't as informative as the url ( https://usegalaxy.org/storage/history/) and referrer. --- .../src/components/History/CurrentHistory/HistoryCounter.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/History/CurrentHistory/HistoryCounter.vue b/client/src/components/History/CurrentHistory/HistoryCounter.vue index bdadcafe08da..038924f0a920 100644 --- a/client/src/components/History/CurrentHistory/HistoryCounter.vue +++ b/client/src/components/History/CurrentHistory/HistoryCounter.vue @@ -57,6 +57,9 @@ const showPreferredObjectStoreModal = ref(false); const historyPreferredObjectStoreId = ref(props.history.preferred_object_store_id); const niceHistorySize = computed(() => prettyBytes(historySize.value)); +const canManageStorage = computed( + () => userOwnsHistory(currentUser.value, props.history) && !currentUser.value?.isAnonymous +); const storageLocationTitle = computed(() => { if (isOnlyPreference.value) { @@ -137,7 +140,7 @@ onMounted(() => { variant="link" size="sm" class="rounded-0 text-decoration-none history-storage-overview-button" - :disabled="!userOwnsHistory(currentUser, props.history)" + :disabled="!canManageStorage" data-description="storage dashboard button" @click="onDashboard">