Add an extra assert to Data.saveMessage
This commit is contained in:
parent
3e644f45cf
commit
3111b804de
1 changed files with 9 additions and 1 deletions
|
@ -33,7 +33,7 @@ import { STORAGE_UI_KEYS } from '../types/StorageUIKeys';
|
|||
import { UUID } from '../types/UUID';
|
||||
import type { UUIDStringType } from '../types/UUID';
|
||||
import type { StoredJob } from '../jobs/types';
|
||||
import { assert, assertSync } from '../util/assert';
|
||||
import { assert, assertSync, strictAssert } from '../util/assert';
|
||||
import { combineNames } from '../util/combineNames';
|
||||
import { consoleLogger } from '../util/consoleLogger';
|
||||
import { dropNull } from '../util/dropNull';
|
||||
|
@ -1750,9 +1750,17 @@ function saveMessageSync(
|
|||
readStatus,
|
||||
expireTimer,
|
||||
expirationStartTimestamp,
|
||||
attachments,
|
||||
} = data;
|
||||
let { seenStatus } = data;
|
||||
|
||||
if (attachments) {
|
||||
strictAssert(
|
||||
attachments.every(attachment => !attachment.data),
|
||||
'Attempting to save a hydrated message'
|
||||
);
|
||||
}
|
||||
|
||||
if (readStatus === ReadStatus.Unread && seenStatus !== SeenStatus.Unseen) {
|
||||
log.warn(
|
||||
`saveMessage: Message ${id}/${type} is unread but had seenStatus=${seenStatus}. Forcing to UnseenStatus.Unseen.`
|
||||
|
|
Loading…
Reference in a new issue