Use call link color in create, update, show

This commit is contained in:
ayumi-signal 2024-06-26 10:35:48 -07:00 committed by GitHub
parent f8af3fcdf6
commit 932e4c3343
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 33 additions and 20 deletions

View file

@ -3,7 +3,7 @@
import { sample } from 'lodash';
import { AvatarColors } from '../types/Colors';
import { AVATAR_COLOR_COUNT, AvatarColors } from '../types/Colors';
import type { ConversationAttributesType } from '../model-types';
import type { AvatarColorType, CustomColorType } from '../types/Colors';
import type { ServiceIdString } from '../types/ServiceId';
@ -22,7 +22,7 @@ export function migrateColor(
return sample(AvatarColors) || AvatarColors[0];
}
const index = (parseInt(serviceId.slice(-4), 16) || 0) % AvatarColors.length;
const index = (parseInt(serviceId.slice(-4), 16) || 0) % AVATAR_COLOR_COUNT;
return AvatarColors[index];
}