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 { UUID } from '../types/UUID';
|
||||||
import type { UUIDStringType } from '../types/UUID';
|
import type { UUIDStringType } from '../types/UUID';
|
||||||
import type { StoredJob } from '../jobs/types';
|
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 { combineNames } from '../util/combineNames';
|
||||||
import { consoleLogger } from '../util/consoleLogger';
|
import { consoleLogger } from '../util/consoleLogger';
|
||||||
import { dropNull } from '../util/dropNull';
|
import { dropNull } from '../util/dropNull';
|
||||||
|
@ -1750,9 +1750,17 @@ function saveMessageSync(
|
||||||
readStatus,
|
readStatus,
|
||||||
expireTimer,
|
expireTimer,
|
||||||
expirationStartTimestamp,
|
expirationStartTimestamp,
|
||||||
|
attachments,
|
||||||
} = data;
|
} = data;
|
||||||
let { seenStatus } = 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) {
|
if (readStatus === ReadStatus.Unread && seenStatus !== SeenStatus.Unseen) {
|
||||||
log.warn(
|
log.warn(
|
||||||
`saveMessage: Message ${id}/${type} is unread but had seenStatus=${seenStatus}. Forcing to UnseenStatus.Unseen.`
|
`saveMessage: Message ${id}/${type} is unread but had seenStatus=${seenStatus}. Forcing to UnseenStatus.Unseen.`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue