Ignore delivery receipts for outgoing reactions
This commit is contained in:
parent
c8099171e2
commit
e46b1f7958
8 changed files with 151 additions and 34 deletions
|
@ -8,6 +8,7 @@ import dataInterface from '../../sql/Client';
|
|||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { ReactionType } from '../../types/Reactions';
|
||||
import { ReactionReadStatus } from '../../types/Reactions';
|
||||
import { DurationInSeconds } from '../../util/durations';
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||
|
@ -24,6 +25,8 @@ const {
|
|||
getUnreadReactionsAndMarkRead,
|
||||
} = dataInterface;
|
||||
|
||||
const UNREAD_REACTION = { readStatus: ReactionReadStatus.Unread };
|
||||
|
||||
describe('sql/markRead', () => {
|
||||
beforeEach(async () => {
|
||||
await _removeAllMessages();
|
||||
|
@ -528,6 +531,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message1.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction2: ReactionType = {
|
||||
conversationId,
|
||||
|
@ -537,6 +541,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message2.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction3: ReactionType = {
|
||||
conversationId: generateUuid(),
|
||||
|
@ -546,6 +551,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message3.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction4: ReactionType = {
|
||||
conversationId,
|
||||
|
@ -555,6 +561,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message4.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction5: ReactionType = {
|
||||
conversationId,
|
||||
|
@ -564,13 +571,14 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message5.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
|
||||
await addReaction(reaction1);
|
||||
await addReaction(reaction2);
|
||||
await addReaction(reaction3);
|
||||
await addReaction(reaction4);
|
||||
await addReaction(reaction5);
|
||||
await addReaction(reaction1, UNREAD_REACTION);
|
||||
await addReaction(reaction2, UNREAD_REACTION);
|
||||
await addReaction(reaction3, UNREAD_REACTION);
|
||||
await addReaction(reaction4, UNREAD_REACTION);
|
||||
await addReaction(reaction5, UNREAD_REACTION);
|
||||
|
||||
assert.lengthOf(await _getAllReactions(), 5);
|
||||
const markedRead = await getUnreadReactionsAndMarkRead({
|
||||
|
@ -677,6 +685,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message1.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction2: ReactionType = {
|
||||
conversationId,
|
||||
|
@ -686,6 +695,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message2.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction3: ReactionType = {
|
||||
conversationId: generateUuid(),
|
||||
|
@ -695,6 +705,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message3.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction4: ReactionType = {
|
||||
conversationId,
|
||||
|
@ -704,6 +715,7 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message4.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
const reaction5: ReactionType = {
|
||||
conversationId,
|
||||
|
@ -713,13 +725,14 @@ describe('sql/markRead', () => {
|
|||
messageReceivedAt: message5.received_at,
|
||||
targetAuthorAci: generateAci(),
|
||||
targetTimestamp: start,
|
||||
timestamp: start,
|
||||
};
|
||||
|
||||
await addReaction(reaction1);
|
||||
await addReaction(reaction2);
|
||||
await addReaction(reaction3);
|
||||
await addReaction(reaction4);
|
||||
await addReaction(reaction5);
|
||||
await addReaction(reaction1, UNREAD_REACTION);
|
||||
await addReaction(reaction2, UNREAD_REACTION);
|
||||
await addReaction(reaction3, UNREAD_REACTION);
|
||||
await addReaction(reaction4, UNREAD_REACTION);
|
||||
await addReaction(reaction5, UNREAD_REACTION);
|
||||
|
||||
assert.lengthOf(await _getAllReactions(), 5);
|
||||
const markedRead = await getUnreadReactionsAndMarkRead({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue