fix: 외교문서와 수뇌 예약의 Ref 계약을 복원한다
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { enqueuePrivateMessageWebPush, GamePrisma } from '@sammo-ts/infra';
|
||||
import { MAX_SAFE_GAME_TICK } from '@sammo-ts/common';
|
||||
import type { MessagePayload, MessageRecordDraft, MessageType } from '@sammo-ts/logic';
|
||||
|
||||
import type { DatabaseClient } from '../context.js';
|
||||
@@ -63,6 +64,11 @@ const toMessageView = (row: MessageRow): MessageView => {
|
||||
export const insertMessage = async (db: DatabaseClient, draft: MessageRecordDraft): Promise<number> => {
|
||||
const gameTime = await loadCurrentGameTime(db);
|
||||
const toTickOrNull = (date: Date): bigint | null => {
|
||||
// Ref represents its unlimited 9999-12-31 message lifetime with the
|
||||
// largest safe game tick instead of falling back to a wall-clock-only row.
|
||||
if (date.getUTCFullYear() >= 9000) {
|
||||
return BigInt(MAX_SAFE_GAME_TICK);
|
||||
}
|
||||
try {
|
||||
const tick = gameTime.dateToTick(date);
|
||||
return tick === null ? null : BigInt(tick);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MessageTarget } from '@sammo-ts/logic';
|
||||
import { resolveMessageTargetIcon, type MessageTarget } from '@sammo-ts/logic';
|
||||
|
||||
import type { DatabaseClient, GeneralRow } from '../context.js';
|
||||
|
||||
@@ -42,5 +42,5 @@ export const buildNationTarget = (nationId: number, nationName: string, color: s
|
||||
nationId,
|
||||
nationName,
|
||||
color,
|
||||
icon: '',
|
||||
icon: resolveMessageTargetIcon(null),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user