Eliminate eslint-generated triple-parents

This commit is contained in:
Scott Nonnenberg 2018-04-10 17:00:30 -07:00
parent 5c2936bdd6
commit 5602241a0c
No known key found for this signature in database
GPG key ID: 5F82280C35134661
3 changed files with 26 additions and 26 deletions

View file

@ -867,9 +867,9 @@
unreadMessages = unreadMessages.filter(m => Boolean(m.isIncoming()));
const unreadCount = unreadMessages.length - read.length;
const promise = new Promise(((resolve, reject) => {
const promise = new Promise((resolve, reject) => {
this.save({ unreadCount }).then(resolve, reject);
}));
});
promises.push(promise);
// If a message has errors, we don't want to send anything out about it.
@ -1018,13 +1018,13 @@
});
},
setProfileKey(key) {
return new Promise(((resolve, reject) => {
return new Promise((resolve, reject) => {
if (!constantTimeEqualArrayBuffers(this.get('profileKey'), key)) {
this.save({ profileKey: key }).then(resolve, reject);
} else {
resolve();
}
}));
});
},
fetchMessages() {
@ -1205,14 +1205,14 @@
},
getNotificationIcon() {
return new Promise(((resolve) => {
return new Promise((resolve) => {
const avatar = this.getAvatar();
if (avatar.url) {
resolve(avatar.url);
} else {
resolve(new Whisper.IdenticonSVGView(avatar).getDataUrl());
}
}));
});
},
notify(message) {
@ -1264,9 +1264,9 @@
},
destroyAll() {
return Promise.all(this.models.map(m => new Promise(((resolve, reject) => {
return Promise.all(this.models.map(m => new Promise((resolve, reject) => {
m.destroy().then(resolve).fail(reject);
}))));
})));
},
search(providedQuery) {
@ -1276,7 +1276,7 @@
const lastCharCode = query.charCodeAt(query.length - 1);
const nextChar = String.fromCharCode(lastCharCode + 1);
const upper = query.slice(0, -1) + nextChar;
return new Promise(((resolve) => {
return new Promise((resolve) => {
this.fetch({
index: {
name: 'search', // 'search' index on tokens array
@ -1285,31 +1285,31 @@
excludeUpper: true,
},
}).always(resolve);
}));
});
}
return Promise.resolve();
},
fetchAlphabetical() {
return new Promise(((resolve) => {
return new Promise((resolve) => {
this.fetch({
index: {
name: 'search', // 'search' index on tokens array
},
limit: 100,
}).always(resolve);
}));
});
},
fetchGroups(number) {
return new Promise(((resolve) => {
return new Promise((resolve) => {
this.fetch({
index: {
name: 'group',
only: number,
},
}).always(resolve);
}));
});
},
});
@ -1321,14 +1321,14 @@
storeName: 'conversations',
model: Whisper.Conversation,
fetchGroups(number) {
return new Promise(((resolve) => {
return new Promise((resolve) => {
this.fetch({
index: {
name: 'group',
only: number,
},
}).always(resolve);
}));
});
},
});
}());

View file

@ -420,7 +420,7 @@
const GROUP_TYPES = textsecure.protobuf.GroupContext.Type;
const conversation = ConversationController.get(conversationId);
return conversation.queueJob(() => new Promise(((resolve) => {
return conversation.queueJob(() => new Promise((resolve) => {
const now = new Date().getTime();
let attributes = { type: 'private' };
if (dataMessage.group) {
@ -637,7 +637,7 @@
});
}, handleError);
}, handleError);
})));
}));
},
markRead(readAt) {
this.unset('unread');
@ -647,9 +647,9 @@
Whisper.Notifications.remove(Whisper.Notifications.where({
messageId: this.id,
}));
return new Promise(((resolve, reject) => {
return new Promise((resolve, reject) => {
this.save().then(resolve, reject);
}));
});
},
isExpiring() {
return this.get('expireTimer') && this.get('expirationStartTimestamp');
@ -708,9 +708,9 @@
}
},
destroyAll() {
return Promise.all(this.models.map(m => new Promise(((resolve, reject) => {
return Promise.all(this.models.map(m => new Promise((resolve, reject) => {
m.destroy().then(resolve).fail(reject);
}))));
})));
},
fetchSentAt(timestamp) {
@ -745,7 +745,7 @@
if (unreadCount > 0) {
startingLoadedUnread = this.getLoadedUnreadCount();
}
return new Promise(((resolve) => {
return new Promise((resolve) => {
let upper;
if (this.length === 0) {
// fetch the most recent messages first
@ -765,7 +765,7 @@
// received_at DESC
};
this.fetch(options).always(resolve);
})).then(() => {
}).then(() => {
if (unreadCount <= 0) {
return Promise.resolve();
}

View file

@ -395,7 +395,7 @@ MessageReceiver.prototype.extend({
return -1;
},
onDeliveryReceipt(envelope) {
return new Promise(((resolve, reject) => {
return new Promise((resolve, reject) => {
const ev = new Event('delivery');
ev.confirm = this.removeFromCache.bind(this, envelope);
ev.deliveryReceipt = {
@ -404,7 +404,7 @@ MessageReceiver.prototype.extend({
sourceDevice: envelope.sourceDevice,
};
this.dispatchAndWait(ev).then(resolve, reject);
}));
});
},
unpad(paddedData) {
const paddedPlaintext = new Uint8Array(paddedData);