Review comments

pull/187/head
Beaudan 6 years ago
parent 2311bd1328
commit 2d9e6a7ac8

@ -79,29 +79,26 @@ class LokiSnodeAPI {
} }
async getSwarmNodesForPubKey(pubKey) { async getSwarmNodesForPubKey(pubKey) {
let conversation;
let swarmNodes;
try { try {
conversation = ConversationController.get(pubKey); const conversation = ConversationController.get(pubKey);
swarmNodes = [...conversation.get('swarmNodes')]; const swarmNodes = [...conversation.get('swarmNodes')];
return swarmNodes;
} catch (e) { } catch (e) {
throw new window.textsecure.ReplayableError({ throw new window.textsecure.ReplayableError({
message: 'Could not get conversation', message: 'Could not get conversation',
}); });
} }
return swarmNodes;
} }
async updateSwarmNodes(pubKey, newNodes) { async updateSwarmNodes(pubKey, newNodes) {
let conversation;
try { try {
conversation = ConversationController.get(pubKey); const conversation = ConversationController.get(pubKey);
await conversation.updateSwarmNodes(newNodes);
} catch (e) { } catch (e) {
throw new window.textsecure.ReplayableError({ throw new window.textsecure.ReplayableError({
message: 'Could not get conversation', message: 'Could not get conversation',
}); });
} }
await conversation.updateSwarmNodes(newNodes);
} }
async getOurSwarmNodes() { async getOurSwarmNodes() {
@ -128,12 +125,7 @@ class LokiSnodeAPI {
async refreshSwarmNodesForPubKey(pubKey) { async refreshSwarmNodesForPubKey(pubKey) {
const newNodes = await this.getFreshSwarmNodes(pubKey); const newNodes = await this.getFreshSwarmNodes(pubKey);
try { this.updateSwarmNodes(pubKey, newNodes);
const conversation = ConversationController.get(pubKey);
await conversation.updateSwarmNodes(newNodes);
} catch (e) {
throw e;
}
} }
async getFreshSwarmNodes(pubKey) { async getFreshSwarmNodes(pubKey) {

Loading…
Cancel
Save