Fix incoming story context quotes
This commit is contained in:
parent
a450e13a99
commit
46aee24faa
1 changed files with 15 additions and 5 deletions
|
@ -24,10 +24,18 @@ export async function findStoryMessage(
|
||||||
}
|
}
|
||||||
|
|
||||||
const sentAt = getTimestampFromLong(sentTimestamp);
|
const sentAt = getTimestampFromLong(sentTimestamp);
|
||||||
|
const ourConversationId =
|
||||||
|
window.ConversationController.getOurConversationIdOrThrow();
|
||||||
|
|
||||||
const inMemoryMessages = window.MessageController.filterBySentAt(sentAt);
|
const inMemoryMessages = window.MessageController.filterBySentAt(sentAt);
|
||||||
const matchingMessage = find(inMemoryMessages, item =>
|
const matchingMessage = find(inMemoryMessages, item =>
|
||||||
isStoryAMatch(item.attributes, conversationId, authorUuid, sentAt)
|
isStoryAMatch(
|
||||||
|
item.attributes,
|
||||||
|
conversationId,
|
||||||
|
ourConversationId,
|
||||||
|
authorUuid,
|
||||||
|
sentAt
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (matchingMessage) {
|
if (matchingMessage) {
|
||||||
|
@ -37,7 +45,7 @@ export async function findStoryMessage(
|
||||||
log.info('findStoryMessage: db lookup needed', sentAt);
|
log.info('findStoryMessage: db lookup needed', sentAt);
|
||||||
const messages = await window.Signal.Data.getMessagesBySentAt(sentAt);
|
const messages = await window.Signal.Data.getMessagesBySentAt(sentAt);
|
||||||
const found = messages.find(item =>
|
const found = messages.find(item =>
|
||||||
isStoryAMatch(item, conversationId, authorUuid, sentAt)
|
isStoryAMatch(item, conversationId, ourConversationId, authorUuid, sentAt)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
@ -49,9 +57,10 @@ export async function findStoryMessage(
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isStoryAMatch(
|
function isStoryAMatch(
|
||||||
message: MessageAttributesType | null | undefined,
|
message: MessageAttributesType | null | undefined,
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
|
ourConversationId: string,
|
||||||
authorUuid: string,
|
authorUuid: string,
|
||||||
sentTimestamp: number
|
sentTimestamp: number
|
||||||
): message is MessageAttributesType {
|
): message is MessageAttributesType {
|
||||||
|
@ -66,7 +75,8 @@ export function isStoryAMatch(
|
||||||
|
|
||||||
return (
|
return (
|
||||||
message.sent_at === sentTimestamp &&
|
message.sent_at === sentTimestamp &&
|
||||||
message.conversationId === conversationId &&
|
getContactId(message) === authorConversationId &&
|
||||||
getContactId(message) === authorConversationId
|
(message.conversationId === conversationId ||
|
||||||
|
message.conversationId === ourConversationId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue