Improve reaction targeting
This commit is contained in:
parent
16f9b64435
commit
cc24f0524b
4 changed files with 571 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue