Derive default conversation color from storage

This commit is contained in:
Josh Perez 2021-08-24 20:15:12 -04:00 committed by GitHub
parent 8f4a2026e4
commit 347f542ac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 71 deletions

View file

@ -4690,18 +4690,14 @@ export class ConversationModel extends window.Backbone
return migrateColor(this.get('color'));
}
getConversationColor(): ConversationColorType {
const defaultConversationColor = window.Events.getDefaultConversationColor();
return this.get('conversationColor') || defaultConversationColor.color;
getConversationColor(): ConversationColorType | undefined {
return this.get('conversationColor');
}
getCustomColorData(): {
customColor?: CustomColorType;
customColorId?: string;
} {
const defaultConversationColor = window.Events.getDefaultConversationColor();
if (this.getConversationColor() !== 'custom') {
return {
customColor: undefined,
@ -4710,12 +4706,8 @@ export class ConversationModel extends window.Backbone
}
return {
customColor:
this.get('customColor') ||
defaultConversationColor.customColorData?.value,
customColorId:
this.get('customColorId') ||
defaultConversationColor.customColorData?.id,
customColor: this.get('customColor'),
customColorId: this.get('customColorId'),
};
}