Introduce Service Id Types
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
414c0a58d3
commit
366b875fd2
269 changed files with 5832 additions and 5550 deletions
|
@ -3,34 +3,33 @@
|
|||
|
||||
import type { ConversationAttributesType } from '../model-types.d';
|
||||
import type { SignalService as Proto } from '../protobuf';
|
||||
import type { UUID } from '../types/UUID';
|
||||
import type { AciString } from '../types/ServiceId';
|
||||
import * as log from '../logging/log';
|
||||
import { UUIDKind } from '../types/UUID';
|
||||
import { getConversationIdForLogging } from './idForLogging';
|
||||
import { isMemberRequestingToJoin } from './groupMembershipUtils';
|
||||
|
||||
export async function denyPendingApprovalRequest(
|
||||
conversationAttributes: ConversationAttributesType,
|
||||
uuid: UUID
|
||||
aci: AciString
|
||||
): Promise<Proto.GroupChange.Actions | undefined> {
|
||||
const idLog = getConversationIdForLogging(conversationAttributes);
|
||||
|
||||
// This user's pending state may have changed in the time between the user's
|
||||
// button press and when we get here. It's especially important to check here
|
||||
// in conflict/retry cases.
|
||||
if (!isMemberRequestingToJoin(conversationAttributes, uuid)) {
|
||||
if (!isMemberRequestingToJoin(conversationAttributes, aci)) {
|
||||
log.warn(
|
||||
`denyPendingApprovalRequest/${idLog}: ${uuid} is not requesting ` +
|
||||
`denyPendingApprovalRequest/${idLog}: ${aci} is not requesting ` +
|
||||
'to join the group. Returning early.'
|
||||
);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const ourUuid = window.textsecure.storage.user.getCheckedUuid(UUIDKind.ACI);
|
||||
const ourAci = window.textsecure.storage.user.getCheckedAci();
|
||||
|
||||
return window.Signal.Groups.buildDeletePendingAdminApprovalMemberChange({
|
||||
group: conversationAttributes,
|
||||
ourUuid,
|
||||
uuid,
|
||||
ourAci,
|
||||
aci,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue