Use implicit content hint for sender key distribution messages

This commit is contained in:
Scott Nonnenberg 2022-11-28 15:30:42 -08:00 committed by GitHub
parent ca638dd44f
commit a8ce959405
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -2362,7 +2362,7 @@ export default class MessageSender {
story, story,
urgent, urgent,
}: Readonly<{ }: Readonly<{
contentHint: number; contentHint?: number;
distributionId: string; distributionId: string;
groupId: string | undefined; groupId: string | undefined;
identifiers: ReadonlyArray<string>; identifiers: ReadonlyArray<string>;
@ -2373,6 +2373,7 @@ export default class MessageSender {
options?: Readonly<SendOptionsType> options?: Readonly<SendOptionsType>
): Promise<CallbackResultType> { ): Promise<CallbackResultType> {
const timestamp = Date.now(); const timestamp = Date.now();
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
const contentMessage = await this.getSenderKeyDistributionMessage( const contentMessage = await this.getSenderKeyDistributionMessage(
distributionId, distributionId,
{ {
@ -2384,7 +2385,7 @@ export default class MessageSender {
const sendLogCallback = const sendLogCallback =
identifiers.length > 1 identifiers.length > 1
? this.makeSendLogCallback({ ? this.makeSendLogCallback({
contentHint, contentHint: contentHint ?? ContentHint.IMPLICIT,
proto: Buffer.from(Proto.Content.encode(contentMessage).finish()), proto: Buffer.from(Proto.Content.encode(contentMessage).finish()),
sendType: 'senderKeyDistributionMessage', sendType: 'senderKeyDistributionMessage',
timestamp, timestamp,
@ -2394,7 +2395,7 @@ export default class MessageSender {
: undefined; : undefined;
return this.sendGroupProto({ return this.sendGroupProto({
contentHint, contentHint: contentHint ?? ContentHint.IMPLICIT,
groupId, groupId,
options, options,
proto: contentMessage, proto: contentMessage,

View file

@ -297,7 +297,6 @@ async function sendDistributionMessageOrNullMessage(
options: RetryRequestEventData, options: RetryRequestEventData,
didArchive: boolean didArchive: boolean
): Promise<void> { ): Promise<void> {
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
const { groupId, requesterUuid } = options; const { groupId, requesterUuid } = options;
let sentDistributionMessage = false; let sentDistributionMessage = false;
log.info(`sendDistributionMessageOrNullMessage/${logId}: Starting...`); log.info(`sendDistributionMessageOrNullMessage/${logId}: Starting...`);
@ -334,7 +333,6 @@ async function sendDistributionMessageOrNullMessage(
await handleMessageSend( await handleMessageSend(
messaging.sendSenderKeyDistributionMessage( messaging.sendSenderKeyDistributionMessage(
{ {
contentHint: ContentHint.RESENDABLE,
distributionId, distributionId,
groupId, groupId,
identifiers: [requesterUuid], identifiers: [requesterUuid],

View file

@ -437,7 +437,7 @@ export async function sendToGroupViaSenderKey(options: {
await handleMessageSend( await handleMessageSend(
window.textsecure.messaging.sendSenderKeyDistributionMessage( window.textsecure.messaging.sendSenderKeyDistributionMessage(
{ {
contentHint: ContentHint.RESENDABLE, contentHint,
distributionId, distributionId,
groupId, groupId,
identifiers: newToMemberUuids, identifiers: newToMemberUuids,