From deea4edbd2de38b7ba3f52fe716f76c0eafa1e47 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 6 Jun 2024 17:00:36 +0200 Subject: [PATCH] scope test --- apps/remix-ide/src/app/plugins/git.tsx | 2 -- .../git/src/components/panels/githubcredentials.tsx | 6 +++++- libs/remix-ui/git/src/lib/gitactions.ts | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/git.tsx b/apps/remix-ide/src/app/plugins/git.tsx index 44e34d632c..35129dfceb 100644 --- a/apps/remix-ide/src/app/plugins/git.tsx +++ b/apps/remix-ide/src/app/plugins/git.tsx @@ -19,8 +19,6 @@ const profile = { export class GitPlugin extends ViewPlugin { - - constructor() { super(profile) diff --git a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx index 8cef98902d..ced728b62b 100644 --- a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx +++ b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx @@ -14,11 +14,13 @@ export const GitHubCredentials = () => { const [githubToken, setGithubToken] = React.useState('') const [githubUsername, setGithubUsername] = React.useState('') const [githubEmail, setGithubEmail] = React.useState('') + const [scopeWarning, setScopeWarning] = React.useState(false) const intl = useIntl() useEffect(() => { refresh() - }, [loader.plugin, context.gitHubAccessToken, context.userEmails, context.gitHubUser]) + setScopeWarning(!(context.gitHubScopes && context.gitHubScopes.length > 0)) + }, [loader.plugin, context.gitHubAccessToken, context.userEmails, context.gitHubUser, context.gitHubScopes]) function handleChangeTokenState(e: string): void { setGithubToken(e) @@ -76,6 +78,8 @@ export const GitHubCredentials = () => { + {scopeWarning? +
Your GitHub token may not have the correct permissions. Please use the login with GitHub feature.
:null}
); diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index 58e8874aea..f1904758ef 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -544,6 +544,7 @@ export const saveGitHubCredentials = async (credentials: { username: string, ema verified: null, visibility: null }])) + dispatch(setScopes([])) } } catch (e) {