fix(profile): send a default avatar to the hangar
Include the default pilot icon in client profile replies when a save has no selected icon. Preserve chosen and legacy icons without modifying stored saves.
This commit is contained in:
1 parent
a940861295
commit
0c9340f883
4 files changed
+9
-9
No files matched your search
@@ -10,15 +10,15 @@
|
||||
*/
|
||||
import { setParam, type BlkBlock } from '@wto/blk';
|
||||
import type { Account } from '../accounts/account-store.ts';
|
||||
import { appearance } from './profile-appearance.ts';
|
||||
import { appearance, DEFAULT_PILOT_ICON } from './profile-appearance.ts';
|
||||
import { clearStoreCart } from './profile-store-cart.ts';
|
||||
import { serverTimeNow } from './server-time.ts';
|
||||
|
||||
export function clientProfile(saved: BlkBlock, account: Account): BlkBlock {
|
||||
const profile = structuredClone(saved);
|
||||
clearStoreCart(profile);
|
||||
const pilotIcon = appearance(profile).pilotIcon;
|
||||
if (pilotIcon !== undefined) setParam(profile, 'pilotIcon', { type: 'string', value: pilotIcon });
|
||||
const pilotIcon = appearance(profile).pilotIcon || DEFAULT_PILOT_ICON;
|
||||
setParam(profile, 'pilotIcon', { type: 'string', value: pilotIcon });
|
||||
setParam(profile, 'charDrivenNick', { type: 'string', value: account.nick });
|
||||
setParam(profile, 'serverTime', { type: 'int64', value: serverTimeNow() });
|
||||
return profile;
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ensureBlock, findBlock, findParam, setParam, type BlkBlock } from '@wto
|
||||
|
||||
const TITLE = 'title';
|
||||
const APPEARANCE = 'pilotAppearance';
|
||||
export const DEFAULT_PILOT_ICON = 'cardicon_default';
|
||||
export const APPEARANCE_FIELDS = ['pilotIcon', 'background', 'frame'] as const;
|
||||
export type AppearanceField = (typeof APPEARANCE_FIELDS)[number];
|
||||
|
||||
|
||||
Reference in new issue
Block a user