Fixed review issues.

Fixed lint error.
pull/41/head
Mikunj 6 years ago
parent 4f4ebf3ddd
commit 17e5c861a1

@ -460,13 +460,13 @@
}
}
},
async onFriendRequestAccepted(updateUnread = false) {
async onFriendRequestAccepted({ updateUnread }) {
// Make sure we don't keep incrementing the unread count
const unreadCount = this.isKeyExchangeCompleted() || !updateUnread ? {} : { unreadCount: this.get('unreadCount') + 1 };
this.set({
friendRequestStatus: null,
keyExchangeCompleted: true,
...unreadCount
...unreadCount,
});
await window.Signal.Data.updateConversation(this.id, this.attributes, {
@ -478,16 +478,17 @@
// Update any pending outgoing messages
const pending = await this.getPendingFriendRequests('outgoing');
for (const request of pending) {
// Only update successfully sent requests
if (request.hasErrors()) continue;
await Promise.all(
pending.map(async request => {
if (request.hasErrors()) return;
request.set({ friendStatus: 'accepted' });
await window.Signal.Data.saveMessage(request.attributes, {
Message: Whisper.Message,
});
this.trigger('updateMessage', request);
}
request.set({ friendStatus: 'accepted' });
await window.Signal.Data.saveMessage(request.attributes, {
Message: Whisper.Message,
});
this.trigger('updateMessage', request);
})
);
await this.updatePendingFriendRequests();
@ -2034,7 +2035,8 @@
notify(message) {
if (!message.isIncoming()) {
if (message.isFriendRequest()) return this.notifyFriendRequest(message.get('source'), 'requested');
if (message.isFriendRequest())
return this.notifyFriendRequest(message.get('source'), 'requested');
return Promise.resolve();
}
const conversationId = this.id;

@ -192,7 +192,8 @@
getNotificationText() {
const description = this.getDescription();
if (description) {
if (this.isFriendRequest()) return `Friend Request: ${description}`;
if (this.isFriendRequest())
return `Friend Request: ${description}`;
return description;
}
if (this.get('attachments').length > 0) {

@ -1024,11 +1024,11 @@ MessageReceiver.prototype.extend({
if (savePreKey) {
await this.handlePreKeyBundleMessage(
envelope.source,
this.decodePreKeyBundleMessage(content.preKeyBundleMessage),
this.decodePreKeyBundleMessage(content.preKeyBundleMessage)
);
// Update the conversation
await conversation.onFriendRequestAccepted(true);
await conversation.onFriendRequestAccepted({ updateUnread: true });
}
}
}

Loading…
Cancel
Save