Clean up migrateColor utility
This commit is contained in:
parent
b47d8d8b2b
commit
12dbd38cb9
3 changed files with 5 additions and 36 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2020-2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
/* eslint-disable class-methods-use-this */
|
/* eslint-disable class-methods-use-this */
|
||||||
|
@ -34,6 +34,7 @@ import {
|
||||||
import { GroupChangeClass } from '../textsecure.d';
|
import { GroupChangeClass } from '../textsecure.d';
|
||||||
import { BodyRangesType } from '../types/Util';
|
import { BodyRangesType } from '../types/Util';
|
||||||
import { getTextWithMentions } from '../util';
|
import { getTextWithMentions } from '../util';
|
||||||
|
import { migrateColor } from '../util/migrateColor';
|
||||||
|
|
||||||
/* eslint-disable more/no-then */
|
/* eslint-disable more/no-then */
|
||||||
window.Whisper = window.Whisper || {};
|
window.Whisper = window.Whisper || {};
|
||||||
|
@ -4103,7 +4104,6 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
return 'signal-blue';
|
return 'signal-blue';
|
||||||
}
|
}
|
||||||
|
|
||||||
const { migrateColor } = Util;
|
|
||||||
return migrateColor(this.get('color'));
|
return migrateColor(this.get('color'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2018-2020 Signal Messenger, LLC
|
// Copyright 2018-2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import * as GoogleChrome from './GoogleChrome';
|
import * as GoogleChrome from './GoogleChrome';
|
||||||
|
@ -19,7 +19,6 @@ import { getUserAgent } from './getUserAgent';
|
||||||
import { hasExpired } from './hasExpired';
|
import { hasExpired } from './hasExpired';
|
||||||
import { isFileDangerous } from './isFileDangerous';
|
import { isFileDangerous } from './isFileDangerous';
|
||||||
import { makeLookup } from './makeLookup';
|
import { makeLookup } from './makeLookup';
|
||||||
import { migrateColor } from './migrateColor';
|
|
||||||
import { missingCaseError } from './missingCaseError';
|
import { missingCaseError } from './missingCaseError';
|
||||||
import { parseRemoteClientExpiration } from './parseRemoteClientExpiration';
|
import { parseRemoteClientExpiration } from './parseRemoteClientExpiration';
|
||||||
import { sleep } from './sleep';
|
import { sleep } from './sleep';
|
||||||
|
@ -41,7 +40,6 @@ export {
|
||||||
hasExpired,
|
hasExpired,
|
||||||
isFileDangerous,
|
isFileDangerous,
|
||||||
makeLookup,
|
makeLookup,
|
||||||
migrateColor,
|
|
||||||
missingCaseError,
|
missingCaseError,
|
||||||
parseRemoteClientExpiration,
|
parseRemoteClientExpiration,
|
||||||
Registration,
|
Registration,
|
||||||
|
|
|
@ -1,51 +1,22 @@
|
||||||
// Copyright 2018-2020 Signal Messenger, LLC
|
// Copyright 2018-2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { ColorType } from '../types/Colors';
|
import { ColorType } from '../types/Colors';
|
||||||
|
|
||||||
type OldColorType =
|
export function migrateColor(color?: string): ColorType {
|
||||||
| 'amber'
|
|
||||||
| 'blue'
|
|
||||||
| 'blue_grey'
|
|
||||||
| 'brown'
|
|
||||||
| 'cyan'
|
|
||||||
| 'deep_orange'
|
|
||||||
| 'deep_purple'
|
|
||||||
| 'green'
|
|
||||||
| 'grey'
|
|
||||||
| 'indigo'
|
|
||||||
| 'lime'
|
|
||||||
| 'light_blue'
|
|
||||||
| 'light_green'
|
|
||||||
| 'orange'
|
|
||||||
| 'pink'
|
|
||||||
| 'purple'
|
|
||||||
| 'red'
|
|
||||||
| 'teal'
|
|
||||||
| 'yellow'
|
|
||||||
| 'ultramarine'
|
|
||||||
| string
|
|
||||||
| undefined;
|
|
||||||
|
|
||||||
export function migrateColor(color?: OldColorType): ColorType {
|
|
||||||
switch (color) {
|
switch (color) {
|
||||||
// These colors no longer exist
|
// These colors no longer exist
|
||||||
case 'orange':
|
case 'orange':
|
||||||
case 'amber':
|
case 'amber':
|
||||||
return 'deep_orange';
|
return 'deep_orange';
|
||||||
|
|
||||||
case 'yellow':
|
case 'yellow':
|
||||||
return 'brown';
|
return 'brown';
|
||||||
|
|
||||||
case 'deep_purple':
|
case 'deep_purple':
|
||||||
return 'purple';
|
return 'purple';
|
||||||
|
|
||||||
case 'light_blue':
|
case 'light_blue':
|
||||||
return 'blue';
|
return 'blue';
|
||||||
|
|
||||||
case 'cyan':
|
case 'cyan':
|
||||||
return 'teal';
|
return 'teal';
|
||||||
|
|
||||||
case 'lime':
|
case 'lime':
|
||||||
return 'light_green';
|
return 'light_green';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue