Skip to content

Commit 254a3c4

Browse files
Laurie T. Malauroboquat
Laurie T. Malau
authored andcommitted
Link to user profile
1 parent 5aad974 commit 254a3c4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

components/dashboard/src/projects/NewProject.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ export default function NewProject() {
274274

275275
const showSearchInput = !!repoSearchFilter || filteredRepos.length > 0;
276276

277+
const userLink = (r: ProviderRepository) => {
278+
return `https://${new URL(r.cloneUrl).host}/${r.inUse?.userName}`
279+
}
280+
277281
const projectText = () => {
278282
return <p className="text-gray-500 text-center text-base">Projects allow you to manage prebuilds and workspaces for your repository. <a href="https://www.gitpod.io/docs/teams-and-projects" rel="noopener" className="gp-link">Learn more</a></p>
279283
}
@@ -324,7 +328,7 @@ export default function NewProject() {
324328
<button className="primary" onClick={() => setSelectedRepo(r)}>Select</button>
325329
) : (
326330
<p className="text-gray-500 font-medium">
327-
@{r.inUse.userName} already<br/>added this repo
331+
<a rel="noopener" className="gp-link" href={userLink(r)}>@{r.inUse.userName}</a> already<br/>added this repo
328332
</p>
329333
)}
330334
</div>

components/server/ee/src/workspace/gitpod-server-impl.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { SnapshotService, WaitForSnapshotOptions } from "./snapshot-service";
4242
import { SafePromise } from "@gitpod/gitpod-protocol/lib/util/safe-promise";
4343
import { ClientMetadata } from "../../../src/websocket/websocket-connection-manager";
4444
import { BitbucketAppSupport } from "../bitbucket/bitbucket-app-support";
45+
import { URL } from 'url';
4546

4647
@injectable()
4748
export class GitpodServerEEImpl extends GitpodServerImpl {
@@ -1444,12 +1445,17 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
14441445

14451446
for (const repo of repositories) {
14461447
const p = cloneUrlToProject.get(repo.cloneUrl);
1448+
const repoProvider = new URL(repo.cloneUrl).host.split(".")[0];
1449+
14471450
if (p) {
14481451
if (p.userId) {
14491452
const owner = await this.userDB.findUserById(p.userId);
14501453
if (owner) {
1451-
repo.inUse = {
1452-
userName: owner?.name || owner?.fullName || 'somebody'
1454+
const ownerProviderMatchingRepoProvider = owner.identities.find((identity, index) => identity.authProviderId.toLowerCase().includes(repoProvider));
1455+
if (ownerProviderMatchingRepoProvider) {
1456+
repo.inUse = {
1457+
userName: ownerProviderMatchingRepoProvider?.authName
1458+
}
14531459
}
14541460
}
14551461
} else if (p.teamOwners && p.teamOwners[0]) {

0 commit comments

Comments
 (0)