Review moving status setting to conversation init

pull/307/head
Beaudan 6 years ago
parent 3bb9d888dc
commit ab15a4afd6

@ -167,6 +167,9 @@
// Online status handling
this.set({ isOnline: lokiP2pAPI.isOnline(this.id) });
if (this.id === this.ourNumber) {
this.setFriendRequestStatus(FriendRequestStatusEnum.friends);
}
this.messageSendQueue = new JobQueue();
@ -642,8 +645,12 @@
async setFriendRequestStatus(newStatus) {
// Ensure that the new status is a valid FriendStatusEnum value
if (!(newStatus in Object.values(FriendRequestStatusEnum))) return;
const me = textsecure.storage.user.getNumber();
if (me === this.id && newStatus !== FriendRequestStatusEnum.friends) return;
if (
this.ourNumber === this.id &&
newStatus !== FriendRequestStatusEnum.friends
) {
return;
}
if (this.get('friendRequestStatus') !== newStatus) {
this.set({ friendRequestStatus: newStatus });
await window.Signal.Data.updateConversation(this.id, this.attributes, {

@ -537,7 +537,6 @@
// Update the conversation if we have it
const newProfile = storage.getLocalProfile();
await conversation.setProfile(newProfile);
await conversation.setFriendRequestStatus(window.friends.friendRequestStatusEnum.friends);
this.dispatchEvent(new Event('registration'));
},

Loading…
Cancel
Save