Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/messages/reaction-message-spec.js
Show All 12 Lines | |||||
import { | import { | ||||
assertMessageType, | assertMessageType, | ||||
messageTypes, | messageTypes, | ||||
} from '../../types/message-types-enum.js'; | } from '../../types/message-types-enum.js'; | ||||
import { | import { | ||||
type MessageInfo, | type MessageInfo, | ||||
type ClientDBMessageInfo, | type ClientDBMessageInfo, | ||||
} from '../../types/message-types.js'; | } from '../../types/message-types.js'; | ||||
import type { | import { | ||||
ReactionMessageData, | type ReactionMessageData, | ||||
RawReactionMessageInfo, | type RawReactionMessageInfo, | ||||
ReactionMessageInfo, | type ReactionMessageInfo, | ||||
rawReactionMessageInfoValidator, | |||||
} from '../../types/messages/reaction.js'; | } from '../../types/messages/reaction.js'; | ||||
import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; | import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; | ||||
import type { NotifTexts } from '../../types/notif-types.js'; | import type { NotifTexts } from '../../types/notif-types.js'; | ||||
import type { ThreadInfo } from '../../types/thread-types.js'; | import type { ThreadInfo } from '../../types/thread-types.js'; | ||||
import type { RelativeUserInfo } from '../../types/user-types.js'; | import type { RelativeUserInfo } from '../../types/user-types.js'; | ||||
import { ET } from '../../utils/entity-text.js'; | import { ET } from '../../utils/entity-text.js'; | ||||
import { threadIsGroupChat } from '../thread-utils.js'; | import { threadIsGroupChat } from '../thread-utils.js'; | ||||
import { hasMinCodeVersion } from '../version-utils.js'; | import { hasMinCodeVersion } from '../version-utils.js'; | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | const targetMessageInfo = await fetchMessageInfoByID( | ||||
rawMessageInfo.targetMessageID, | rawMessageInfo.targetMessageID, | ||||
); | ); | ||||
if (targetMessageInfo?.creatorID !== notifTargetUserID) { | if (targetMessageInfo?.creatorID !== notifTargetUserID) { | ||||
return undefined; | return undefined; | ||||
} | } | ||||
return action === 'add_reaction' ? pushTypes.NOTIF : pushTypes.RESCIND; | return action === 'add_reaction' ? pushTypes.NOTIF : pushTypes.RESCIND; | ||||
}, | }, | ||||
validator: rawReactionMessageInfoValidator, | |||||
}); | }); |