Skip to content

Commit bd8fb0b

Browse files
committed
fixup
1 parent 3ec7952 commit bd8fb0b

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

components/dashboard/src/projects/NewProject.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function NewProject() {
2323
const location = useLocation();
2424
const history = useHistory();
2525
const { teams } = useContext(TeamsContext);
26-
const { user } = useContext(UserContext);
26+
const { user, setUser } = useContext(UserContext);
2727

2828
const [provider, setProvider] = useState<string>("github.com");
2929
const [reposInAccounts, setReposInAccounts] = useState<ProviderRepository[]>([]);
@@ -281,7 +281,10 @@ export default function NewProject() {
281281

282282
const empty = reposInAccounts.length === 0;
283283

284-
const onGitProviderSeleted = (host: string) => {
284+
const onGitProviderSeleted = async (host: string, updateUser?: boolean) => {
285+
if (updateUser) {
286+
setUser(await getGitpodService().server.getLoggedInUser());
287+
}
285288
setShowGitProviders(false);
286289
setProvider(host);
287290
}
@@ -347,7 +350,7 @@ export default function NewProject() {
347350
}
348351

349352
function GitProviders(props: {
350-
onHostSelected: (host: string) => void
353+
onHostSelected: (host: string, updateUser?: boolean) => void
351354
}) {
352355
const [authProviders, setAuthProviders] = useState<AuthProviderInfo[]>([]);
353356

@@ -367,8 +370,8 @@ function GitProviders(props: {
367370
await openAuthorizeWindow({
368371
host: ap.host,
369372
scopes: ap.requirements?.default,
370-
onSuccess: () => {
371-
props.onHostSelected(ap.host);
373+
onSuccess: async () => {
374+
props.onHostSelected(ap.host, true);
372375
},
373376
onError: (error) => {
374377
console.log(error);

components/server/ee/src/github/github-app-support.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class GitHubAppSupport {
5959
name: r.name,
6060
cloneUrl: r.clone_url,
6161
account: r.owner.login,
62-
accountAvatarUrl: r.owner.avatar_url,
62+
accountAvatarUrl: r.owner?.avatar_url,
6363
updatedAt: r.updated_at,
6464
installationId: installation.data.id,
6565
installationUpdatedAt: installation.data.updated_at

components/server/src/gitlab/gitlab-repository-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class GitlabRepositoryProvider implements RepositoryProvider {
2727
const cloneUrl = response.http_url_to_repo;
2828
const description = response.default_branch;
2929
const host = parseRepoUrl(cloneUrl)!.host;
30-
const avatarUrl = response.owner.avatar_url || undefined;
30+
const avatarUrl = response.owner?.avatar_url || undefined;
3131
const webUrl = response.web_url;
3232
return { host, owner, name, cloneUrl, description, avatarUrl, webUrl };
3333
}

0 commit comments

Comments
 (0)