mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-20 01:56:33 +00:00
lint fixes
This commit is contained in:
parent
6640f52777
commit
938775ad05
@ -371,17 +371,15 @@ class Channel {
|
||||
participants: chatId.pub || chatId,
|
||||
save: false
|
||||
}));
|
||||
} else {
|
||||
if (chatId.uuid && chatId.participants && chatId.myGroupSecret) {
|
||||
callback(new Channel({
|
||||
key: keypair,
|
||||
gun,
|
||||
participants: chatId.participants,
|
||||
uuid: chatId.uuid,
|
||||
myGroupSecret: chatId.myGroupSecret,
|
||||
save: false
|
||||
}));
|
||||
}
|
||||
} else if (chatId.uuid && chatId.participants && chatId.myGroupSecret) {
|
||||
callback(new Channel({
|
||||
key: keypair,
|
||||
gun,
|
||||
participants: chatId.participants,
|
||||
uuid: chatId.uuid,
|
||||
myGroupSecret: chatId.myGroupSecret,
|
||||
save: false
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -734,7 +732,7 @@ class Channel {
|
||||
if (typeof callback !== 'function') {
|
||||
throw new Error(`onTheir callback must be a function, got ${typeof callback}`);
|
||||
}
|
||||
if (!this.directSubscriptions.hasOwnProperty(key)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.directSubscriptions, key)) {
|
||||
this.directSubscriptions[key] = [];
|
||||
}
|
||||
this.directSubscriptions[key].push({key, callback, from});
|
||||
@ -766,7 +764,7 @@ class Channel {
|
||||
if (typeof callback !== 'function') {
|
||||
throw new Error(`onTheir callback must be a function, got ${typeof callback}`);
|
||||
}
|
||||
if (!this.groupSubscriptions.hasOwnProperty(key)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.groupSubscriptions, key)) {
|
||||
this.groupSubscriptions[key] = [];
|
||||
}
|
||||
const subscription = {key, callback, from};
|
||||
@ -846,9 +844,8 @@ class Channel {
|
||||
getSimpleLink(urlRoot = 'https://iris.to/') {
|
||||
if (this.uuid) {
|
||||
return `${urlRoot}?channelId=${this.uuid}&inviter=${this.key.pub}`;
|
||||
} else {
|
||||
return `${urlRoot}?chatWith=${this.getCurrentParticipants()[0]}`;
|
||||
}
|
||||
return `${urlRoot}?chatWith=${this.getCurrentParticipants()[0]}`;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1122,9 +1119,8 @@ class Channel {
|
||||
const enc = encodeURIComponent;
|
||||
if (channelId && inviter) {
|
||||
return `${urlRoot}?channelId=${enc(channelId)}&inviter=${enc(inviter)}&s=${enc(sharedSecret)}&k=${enc(linkId)}`;
|
||||
} else {
|
||||
return `${urlRoot}?chatWith=${enc(chatWith)}&s=${enc(sharedSecret)}&k=${enc(linkId)}`;
|
||||
}
|
||||
return `${urlRoot}?chatWith=${enc(chatWith)}&s=${enc(sharedSecret)}&k=${enc(linkId)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,23 +0,0 @@
|
||||
class Social {
|
||||
groupGet(path, callback, groupNode = State.local.get('groups').get('follows')) {
|
||||
const follows = {};
|
||||
groupNode.map((isFollowing, user) => {
|
||||
if (follows[user] && follows[user] === isFollowing) { return; }
|
||||
follows[user] = isFollowing;
|
||||
if (isFollowing) { // TODO: callback on unfollow, for unsubscribe
|
||||
const node = _.reduce(path.split('/'), (sum, s) => sum.get(decodeURIComponent(s)), State.public.user(user));
|
||||
callback(node, user);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
groupMap(path, callback, groupNode = State.local.get('groups').get('follows')) {
|
||||
groupGet(path, (node, from) => node.map((...args) => callback(...args, from)), groupNode);
|
||||
}
|
||||
|
||||
groupOn(path, callback, groupNode = State.local.get('groups').get('follows')) {
|
||||
groupGet(path, (node, from) => node.on((...args) => callback(...args, from)), groupNode);
|
||||
}
|
||||
}
|
||||
|
||||
export default Social;
|
@ -79,13 +79,10 @@ async function loadGunDepth(chain, maxDepth = 2, opts = {}) {
|
||||
}
|
||||
|
||||
export default {
|
||||
loadGunDepth: loadGunDepth,
|
||||
|
||||
gunOnceDefined: gunOnceDefined,
|
||||
|
||||
gunAsAnotherUser: gunAsAnotherUser,
|
||||
|
||||
getHash: async function(str, format = `base64`) {
|
||||
loadGunDepth,
|
||||
gunOnceDefined,
|
||||
gunAsAnotherUser,
|
||||
getHash: async (str, format = `base64`) => {
|
||||
if (!str) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ function deleteChat(pub) {
|
||||
delete Session.channels[pub];
|
||||
State.local.get('channels').get(pub).put(null);
|
||||
route('/chat');
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Group extends View {
|
||||
|
Loading…
Reference in New Issue
Block a user