mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Moved replenishSwarm into libloki-protocol and attached to the window
This commit is contained in:
parent
37ba762312
commit
f09f0f5721
2 changed files with 2 additions and 19 deletions
|
@ -174,7 +174,7 @@
|
|||
return conversation;
|
||||
}
|
||||
|
||||
conversation.refreshSwarmNodes();
|
||||
window.libloki.replenishSwarm(id);
|
||||
try {
|
||||
await window.Signal.Data.saveConversation(conversation.attributes, {
|
||||
Conversation: Whisper.Conversation,
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue