Apply corrections identified by SonarQube (#8457)
This commit is contained in:
+4
-3
@@ -19,6 +19,7 @@ import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { User } from "matrix-js-sdk/src/models/user";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
|
||||
import { MatrixClientPeg } from './MatrixClientPeg';
|
||||
import MultiInviter, { CompletionStates } from './utils/MultiInviter';
|
||||
@@ -84,12 +85,12 @@ export function showRoomInviteDialog(roomId: string, initialText = ""): void {
|
||||
* @returns {boolean} True if valid, false otherwise
|
||||
*/
|
||||
export function isValid3pidInvite(event: MatrixEvent): boolean {
|
||||
if (!event || event.getType() !== "m.room.third_party_invite") return false;
|
||||
if (!event || event.getType() !== EventType.RoomThirdPartyInvite) return false;
|
||||
|
||||
// any events without these keys are not valid 3pid invites, so we ignore them
|
||||
const requiredKeys = ['key_validity_url', 'public_key', 'display_name'];
|
||||
for (let i = 0; i < requiredKeys.length; ++i) {
|
||||
if (!event.getContent()[requiredKeys[i]]) return false;
|
||||
if (requiredKeys.some(key => !event.getContent()[key])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Valid enough by our standards
|
||||
|
||||
Reference in New Issue
Block a user