1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-16 22:01:54 +03:00

Add common utility for checking 3pid invites

We just need to make sure they are structurally sound - actual validation is done by other parties.
This commit is contained in:
Travis Ralston
2019-03-29 11:45:07 -06:00
parent 0258f61f63
commit 07cc640089
4 changed files with 26 additions and 9 deletions

View File

@ -17,6 +17,7 @@ import MatrixClientPeg from './MatrixClientPeg';
import CallHandler from './CallHandler';
import { _t } from './languageHandler';
import * as Roles from './Roles';
import {isValid3pidInvite} from "./RoomInvite";
function textForMemberEvent(ev) {
// XXX: SYJS-16 "sender is sometimes null for join messages"
@ -367,7 +368,7 @@ function textForCallInviteEvent(event) {
function textForThreePidInviteEvent(event) {
const senderName = event.sender ? event.sender.name : event.getSender();
if (!event.getContent().display_name) {
if (!isValid3pidInvite(event)) {
const targetDisplayName = event.getPrevContent().display_name || _t("Someone");
return _t('%(senderName)s revoked the invitation for %(targetDisplayName)s to join the room.', {
senderName,