Rename functions to be less confusing

pull/834/head
Mikunj Varsani 5 years ago
parent a75ef365b8
commit 4f6dd7a8d5

@ -198,15 +198,20 @@
isOnline() {
return this.isMe() || this.get('isOnline');
},
isMe() {
return this.isOurLocalDevice() || this.isOurPrimaryDevice();
},
isOurPrimaryDevice() {
return this.id === window.storage.get('primaryDevicePubKey');
},
async isOurDevice() {
const ourDevices = await window.libloki.storage.getPairedDevicesFor(
this.ourNumber
);
return this.id === this.ourNumber || ourDevices.includes(this.id);
return this.isOurLocalDevice() || ourDevices.includes(this.id);
},
isOurLocalDevice() {
return this.id === this.ourNumber;
},
isPublic() {
return !!(this.id && this.id.match(/^publicChat:/));
@ -892,9 +897,6 @@
throw new Error('Invalid friend request state');
}
},
isOurConversation() {
return this.id === this.ourNumber;
},
isSecondaryDevice() {
return !!this.get('secondaryStatus');
},

@ -411,6 +411,10 @@ MessageSender.prototype = {
const ourNumber = textsecure.storage.user.getNumber();
// Note: Since we're just doing independant tasks,
// using `async` in the `forEach` loop should be fine.
// If however we want to use the results from forEach then
// we would need to convert this to a Promise.all(numbers.map(...))
numbers.forEach(async number => {
// Note: if we are sending a private group message, we do our best to
// ensure we have signal protocol sessions with every member, but if we

@ -55,11 +55,8 @@ export class SessionClosableOverlay extends React.Component<Props, State> {
const conversations = window.getConversations() || [];
const conversationList = conversations.filter((conversation: any) => {
// TODO: We need to handle the case with > 1 secondary device
const isOurDevice =
conversation.isMe() || conversation.isOurConversation();
return (
!isOurDevice &&
!conversation.isMe() &&
conversation.isPrivate() &&
!conversation.isSecondaryDevice() &&
conversation.isFriend()

Loading…
Cancel
Save