From 753083611061724a504599dfeaa041ee3ee4f23c Mon Sep 17 00:00:00 2001 From: Mikunj Date: Tue, 13 Nov 2018 09:18:31 +1100 Subject: [PATCH] Send message status in friend request props. --- js/models/conversations.js | 1 + js/models/messages.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index e7a5ea81f..7ae0d390e 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -989,6 +989,7 @@ if (friendRequestSent) return; } + // Send the friend request! messageWithSchema = await upgradeMessageSchema({ type: 'friend-request', body, diff --git a/js/models/messages.js b/js/models/messages.js index af80477ba..8870c3ff8 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -334,6 +334,7 @@ text: this.createNonBreakingLastSeparator(this.get('body')), source: this.findAndFormatContact(source), target: this.findAndFormatContact(target), + status: this.getMessagePropStatus(), direction, friendStatus, onAccept, @@ -416,7 +417,14 @@ if (this.hasErrors()) { return 'error'; } - if (!this.isOutgoing()) { + + // Handle friend request statuses + const isFriendRequest = this.isFriendRequest(); + const isOutgoingFriendRequest = isFriendRequest && this.get('direction') === 'outgoing'; + const isOutgoing = this.isOutgoing() || isOutgoingFriendRequest; + + // Only return the status on outgoing messages + if (!isOutgoing()) { return null; }