Add type for ConversationModel#getGroupV1Info
This commit is contained in:
parent
d5d808651a
commit
52328c2634
2 changed files with 12 additions and 6 deletions
|
@ -15,7 +15,10 @@ import {
|
||||||
import { AttachmentType } from '../types/Attachment';
|
import { AttachmentType } from '../types/Attachment';
|
||||||
import { CallMode, CallHistoryDetailsType } from '../types/Calling';
|
import { CallMode, CallHistoryDetailsType } from '../types/Calling';
|
||||||
import * as Stickers from '../types/Stickers';
|
import * as Stickers from '../types/Stickers';
|
||||||
import { GroupV2InfoType } from '../textsecure/SendMessage';
|
import type {
|
||||||
|
GroupV1InfoType,
|
||||||
|
GroupV2InfoType,
|
||||||
|
} from '../textsecure/SendMessage';
|
||||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout';
|
import createTaskWithTimeout from '../textsecure/TaskWithTimeout';
|
||||||
import { CallbackResultType } from '../textsecure/Types.d';
|
import { CallbackResultType } from '../textsecure/Types.d';
|
||||||
import { ConversationType } from '../state/ducks/conversations';
|
import { ConversationType } from '../state/ducks/conversations';
|
||||||
|
@ -1134,17 +1137,20 @@ export class ConversationModel extends window.Backbone
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getGroupV1Info(): WhatIsThis {
|
getGroupV1Info(): GroupV1InfoType | undefined {
|
||||||
|
const groupId = this.get('groupId');
|
||||||
|
const groupVersion = this.get('groupVersion');
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isDirectConversation(this.attributes) ||
|
isDirectConversation(this.attributes) ||
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
!groupId ||
|
||||||
this.get('groupVersion')! > 0
|
(groupVersion && groupVersion > 0)
|
||||||
) {
|
) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: this.get('groupId'),
|
id: groupId,
|
||||||
members: this.getRecipients(),
|
members: this.getRecipients(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ export type GroupV2InfoType = {
|
||||||
revision: number;
|
revision: number;
|
||||||
members: Array<string>;
|
members: Array<string>;
|
||||||
};
|
};
|
||||||
type GroupV1InfoType = {
|
export type GroupV1InfoType = {
|
||||||
id: string;
|
id: string;
|
||||||
members: Array<string>;
|
members: Array<string>;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue