|
|
|
@ -87,7 +87,6 @@
|
|
|
|
|
unlockTimestamp: null, // Timestamp used for expiring friend requests.
|
|
|
|
|
sessionResetStatus: SessionResetEnum.none,
|
|
|
|
|
swarmNodes: [],
|
|
|
|
|
refreshPromise: null,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -581,22 +580,6 @@
|
|
|
|
|
throw new Error('Invalid friend request state');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async refreshSwarmNodes() {
|
|
|
|
|
// Refresh promise to ensure that we are only doing a single query at a time
|
|
|
|
|
let refreshPromise = this.get('refreshPromise');
|
|
|
|
|
if (refreshPromise === null) {
|
|
|
|
|
refreshPromise = (async () => {
|
|
|
|
|
const newSwarmNodes = await window.LokiAPI.getSwarmNodes(this.id);
|
|
|
|
|
this.set({ swarmNodes: _.union(this.get('swarmNodes'), newSwarmNodes) });
|
|
|
|
|
await window.Signal.Data.updateConversation(this.id, this.attributes, {
|
|
|
|
|
Conversation: Whisper.Conversation,
|
|
|
|
|
});
|
|
|
|
|
})();
|
|
|
|
|
this.set({ refreshPromise });
|
|
|
|
|
}
|
|
|
|
|
await refreshPromise;
|
|
|
|
|
this.set({ refreshPromise: null });
|
|
|
|
|
},
|
|
|
|
|
async setFriendRequestStatus(newStatus) {
|
|
|
|
|
// Ensure that the new status is a valid FriendStatusEnum value
|
|
|
|
|
if (!(newStatus in Object.values(FriendRequestStatusEnum)))
|
|
|
|
@ -1218,7 +1201,7 @@
|
|
|
|
|
// Add the message sending on another queue so that our UI doesn't get blocked
|
|
|
|
|
this.queueMessageSend(async () => {
|
|
|
|
|
if (this.get('swarmNodes').length === 0) {
|
|
|
|
|
await this.refreshSwarmNodes();
|
|
|
|
|
await window.libloki.replenishSwarm(destination);
|
|
|
|
|
}
|
|
|
|
|
message.send(
|
|
|
|
|
this.wrapSend(
|
|
|
|
|