mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Improve reaction targeting
This commit is contained in:
@@ -11,7 +11,7 @@ import type {
|
||||
QuotedAttachmentType,
|
||||
QuotedMessageType,
|
||||
} from '../model-types.d';
|
||||
import type { ServiceIdString } from '../types/ServiceId';
|
||||
import type { AciString, ServiceIdString } from '../types/ServiceId';
|
||||
import { PaymentEventKind } from '../types/Payment';
|
||||
import type { AnyPaymentEvent } from '../types/Payment';
|
||||
import type { LocalizerType } from '../types/Util';
|
||||
@@ -35,6 +35,27 @@ export function isStory(
|
||||
return message.type === 'story';
|
||||
}
|
||||
|
||||
function isFromUs(
|
||||
message: Pick<ReadonlyMessageAttributesType, 'sourceServiceId'>,
|
||||
ourAci: AciString
|
||||
) {
|
||||
return message.sourceServiceId === ourAci;
|
||||
}
|
||||
|
||||
export function isOutgoingStory(
|
||||
message: Pick<ReadonlyMessageAttributesType, 'type' | 'sourceServiceId'>,
|
||||
ourAci: AciString
|
||||
): boolean {
|
||||
return isStory(message) && isFromUs(message, ourAci);
|
||||
}
|
||||
|
||||
export function isIncomingStory(
|
||||
message: Pick<ReadonlyMessageAttributesType, 'type' | 'sourceServiceId'>,
|
||||
ourAci: AciString
|
||||
): boolean {
|
||||
return isStory(message) && !isFromUs(message, ourAci);
|
||||
}
|
||||
|
||||
export type MessageAttributesWithPaymentEvent = ReadonlyMessageAttributesType &
|
||||
ReadonlyDeep<{
|
||||
payment: AnyPaymentEvent;
|
||||
|
||||
Reference in New Issue
Block a user