Make SonarCloud happier (#9545)

* Make SonarCloud happier

* i18n

* Iterate

* Update AddExistingToSpaceDialog.tsx

* Update SlashCommands.tsx
This commit is contained in:
Michael Telatynski 2022-11-07 13:45:34 +00:00 committed by GitHub
parent 77764d80bc
commit 3747464b41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 131 additions and 162 deletions

View file

@ -716,7 +716,7 @@ export const Commands = [
runFn: function(roomId, args) {
const cli = MatrixClientPeg.get();
let targetRoomId: string;
let targetRoomId: string | undefined;
if (args) {
const matches = args.match(/^(\S+)$/);
if (matches) {
@ -729,15 +729,9 @@ export const Commands = [
// Try to find a room with this alias
const rooms = cli.getRooms();
for (let i = 0; i < rooms.length; i++) {
if (rooms[i].getCanonicalAlias() === roomAlias ||
rooms[i].getAltAliases().includes(roomAlias)
) {
targetRoomId = rooms[i].roomId;
break;
}
if (targetRoomId) break;
}
targetRoomId = rooms.find(room => {
return room.getCanonicalAlias() === roomAlias || room.getAltAliases().includes(roomAlias);
})?.roomId;
if (!targetRoomId) {
return reject(
newTranslatableError(