diff --git a/src/TextForEvent.js b/src/TextForEvent.js index 439d7b9ef5..22ada8849e 100644 --- a/src/TextForEvent.js +++ b/src/TextForEvent.js @@ -9,7 +9,16 @@ function textForMemberEvent(ev) { ) : ""; switch (ev.getContent().membership) { case 'invite': - return senderName + " invited " + targetName + "."; + var threePidContent = ev.getContent().third_party_invite; + if (threePidContent) { + // TODO: When we have third_party_invite.display_name we should + // do this as "$displayname received the invitation from $sender" + // or equiv + return targetName + " received an invitation from " + senderName; + } + else { + return senderName + " invited " + targetName + "."; + } case 'ban': return senderName + " banned " + targetName + "." + reason; case 'join': @@ -101,6 +110,12 @@ function textForCallInviteEvent(event) { return senderName + " placed a " + type + " call." + supported; }; +function textForThreePidInviteEvent(event) { + var senderName = event.sender ? event.sender.name : event.getSender(); + return senderName + " sent an invitation to " + event.getContent().display_name + + " to join the room."; +}; + var handlers = { 'm.room.message': textForMessageEvent, 'm.room.name': textForRoomNameEvent, @@ -109,6 +124,7 @@ var handlers = { 'm.call.invite': textForCallInviteEvent, 'm.call.answer': textForCallAnswerEvent, 'm.call.hangup': textForCallHangupEvent, + 'm.room.third_party_invite': textForThreePidInviteEvent }; module.exports = { diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 8292cdf826..0b26000207 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -44,6 +44,7 @@ var eventTileTypes = { 'm.call.hangup' : 'messages.TextualEvent', 'm.room.name' : 'messages.TextualEvent', 'm.room.topic' : 'messages.TextualEvent', + 'm.room.third_party_invite': 'messages.TextualEvent' }; var MAX_READ_AVATARS = 5;