mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Moves conversation.getProps out of models
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { sample } from 'lodash';
|
||||
import type { AvatarColorType } from '../types/Colors';
|
||||
import { AvatarColors } from '../types/Colors';
|
||||
import type { ConversationAttributesType } from '../model-types';
|
||||
import type { AvatarColorType, CustomColorType } from '../types/Colors';
|
||||
|
||||
const NEW_COLOR_NAMES = new Set(AvatarColors);
|
||||
|
||||
@@ -14,3 +15,20 @@ export function migrateColor(color?: string): AvatarColorType {
|
||||
|
||||
return sample(AvatarColors) || AvatarColors[0];
|
||||
}
|
||||
|
||||
export function getCustomColorData(conversation: ConversationAttributesType): {
|
||||
customColor?: CustomColorType;
|
||||
customColorId?: string;
|
||||
} {
|
||||
if (conversation.conversationColor !== 'custom') {
|
||||
return {
|
||||
customColor: undefined,
|
||||
customColorId: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
customColor: conversation.customColor,
|
||||
customColorId: conversation.customColorId,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user