Review fixes

pull/1176/head
Mikunj 5 years ago
parent 57ea59e5b7
commit a83ce4ee16

@ -1,11 +1,13 @@
interface DeviceMappingAnnotation { interface FileServerPairingAuthorisation {
isPrimary: string;
authorisations: Array<{
primaryDevicePubKey: string; primaryDevicePubKey: string;
secondaryDevicePubKey: string; secondaryDevicePubKey: string;
requestSignature: string; // base64 requestSignature: string; // base64
grantSignature: string; // base64 grantSignature: string; // base64
}>; }
interface DeviceMappingAnnotation {
isPrimary: string;
authorisations: Array<FileServerPairingAuthorisation>;
} }
interface LokiFileServerInstance { interface LokiFileServerInstance {

@ -6,4 +6,4 @@ import * as Types from './types';
// E.g // E.g
// export const messageQueue = new MessageQueue() // export const messageQueue = new MessageQueue()
export { Messages, Protocols }; export { Messages, Protocols, Types };

@ -14,7 +14,7 @@ import { UserUtil } from '../../util';
*/ */
// tslint:disable-next-line: no-unnecessary-class // tslint:disable-next-line: no-unnecessary-class
export class MultiDeviceProtocol { export class MultiDeviceProtocol {
public static refreshDelay: number = 5 * 1000 * 1000; // 5 minutes public static refreshDelay: number = 5 * 60 * 1000; // 5 minutes
private static lastFetch: { [device: string]: number } = {}; private static lastFetch: { [device: string]: number } = {};
/** /**

@ -299,11 +299,22 @@ async function queryConversationsAndContacts(
const conversation = searchResults[i]; const conversation = searchResults[i];
const primaryDevice = resultPrimaryDevices[i]; const primaryDevice = resultPrimaryDevices[i];
if (isSecondaryDevice && PubKey.isEqual(primaryDevice, ourPrimaryDevice)) { if (primaryDevice) {
if (
isSecondaryDevice &&
PubKey.isEqual(primaryDevice, ourPrimaryDevice)
) {
conversations.push(ourNumber); conversations.push(ourNumber);
} else { } else {
conversations.push(primaryDevice.key); conversations.push(primaryDevice.key);
} }
} else if (conversation.type === 'direct') {
contacts.push(conversation.id);
} else if (conversation.type !== 'group') {
contacts.push(conversation.id);
} else {
conversations.push(conversation.id);
}
} }
// Inject synthetic Note to Self entry if query matches localized 'Note to Self' // Inject synthetic Note to Self entry if query matches localized 'Note to Self'
if (noteToSelf.indexOf(providedQuery.toLowerCase()) !== -1) { if (noteToSelf.indexOf(providedQuery.toLowerCase()) !== -1) {

Loading…
Cancel
Save