From aed55c7cfd81206e9cf390fe1e952bce71c49859 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 5 Apr 2025 18:01:15 -0400 Subject: [PATCH] Readable scopes --- app/scenes/Login/OAuthScopeHelper.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/scenes/Login/OAuthScopeHelper.ts b/app/scenes/Login/OAuthScopeHelper.ts index b65c83710c..eb1cddac3c 100644 --- a/app/scenes/Login/OAuthScopeHelper.ts +++ b/app/scenes/Login/OAuthScopeHelper.ts @@ -5,9 +5,9 @@ import uniq from "lodash/uniq"; export class OAuthScopeHelper { public static normalizeScopes(scopes: string[]): string[] { const methodToReadable = { - list: t("read"), - info: t("read"), - read: t("read"), + list: t("view"), + info: t("view"), + read: t("view"), write: t("write"), create: t("write"), update: t("write"), @@ -34,6 +34,13 @@ export class OAuthScopeHelper { }; const normalizedScopes = scopes.map((scope) => { + if (scope === "read") { + return t("View workspace"); + } + if (scope === "write") { + return t("View workspace"); + } + const [namespace, method] = scope.replace("/api/", "").split(/[:\.]/g); const readableMethod = methodToReadable[method as keyof typeof methodToReadable] ?? method;