From a730804943eb6ee204e7907efc7f2dd13dca41fc Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 17 Jul 2015 15:55:36 +0100 Subject: [PATCH] there is no content.target - it's state_key. Also, warn if no target --- src/TextForEvent.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TextForEvent.js b/src/TextForEvent.js index a987e388..ed9eb8a4 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -2,7 +2,7 @@ function textForMemberEvent(ev) { // XXX: SYJS-16 var senderName = ev.sender ? ev.sender.name : ev.getSender(); - var targetName = ev.target ? ev.target.name : ev.getContent().target; + var targetName = ev.target ? ev.target.name : ev.getContent().state_key; var reason = ev.getContent().reason ? ( " Reason: " + ev.getContent().reason ) : ""; @@ -23,6 +23,7 @@ function textForMemberEvent(ev) { return ev.getSender() + " removed their display name"; } } else { + if (!ev.target) console.warn("Join message has no target! -- " + ev.getContent().state_key); return targetName + " joined the room."; } case 'leave':