Check the GitLab instance name when looking for existing connections (#617)

* Check the GitLab instance name when looking for existing connections

* changelog
This commit is contained in:
Will Hunt 2023-01-10 10:42:05 +00:00 committed by GitHub
parent a5ea88578c
commit 4048cc8b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

1
changelog.d/617.bugfix Normal file
View File

@ -0,0 +1 @@
You can now add multiple GitLab connections to the same room with the same project path, if they are under different instances.

View File

@ -206,7 +206,7 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
const stateEventKey = `${validData.instance}/${validData.path}`;
const connection = new GitLabRepoConnection(roomId, stateEventKey, as, validData, tokenStore, instance);
const existingConnections = getAllConnectionsOfType(GitLabRepoConnection);
const existing = existingConnections.find(c => c.roomId === roomId && c.path === connection.path);
const existing = existingConnections.find(c => c.roomId === roomId && c.instance.url === connection.instance.url && c.path === connection.path);
if (existing) {
throw new ApiError("A GitLab repo connection for this project already exists", ErrCode.ConflictingConnection, -1, {