mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
fix: SDA-2882 - Validate notification background color (#1174)
This commit is contained in:
parent
eaf1335359
commit
1baf0834c8
@ -378,6 +378,8 @@ export default class NotificationComp extends React.Component<{}, IState> {
|
||||
data.isInputHidden = true;
|
||||
data.containerHeight = CONTAINER_HEIGHT;
|
||||
|
||||
data.color = this.isValidColor(data.color) ? data.color : '';
|
||||
|
||||
this.resetNotificationData();
|
||||
this.setState(data as IState);
|
||||
|
||||
@ -397,6 +399,15 @@ export default class NotificationComp extends React.Component<{}, IState> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the color
|
||||
* @param color
|
||||
* @private
|
||||
*/
|
||||
private isValidColor(color: string): boolean {
|
||||
return /^#([A-Fa-f0-9]{6})/.test(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset data for new notification
|
||||
* @private
|
||||
|
Loading…
Reference in New Issue
Block a user