SDA-3281 Client 1.5 not sending user picture in Settings > Alerts > See sample

This commit is contained in:
sbenmoussati 2021-08-09 16:25:41 +02:00
parent 9af4cd164f
commit 3c41cf8e50
2 changed files with 13 additions and 3 deletions

View File

@ -34,6 +34,16 @@ describe('Toast notification component', () => {
expect(imageContainer.exists()).toBeFalsy();
});
it('should render Symphony logo if no icon sent - Client 1.5 settings use-case with "See sample" ', () => {
ipcRenderer.send(IPC_RENDERER_NOTIFICATION_DATA_CHANNEL, {
...defaultProps,
});
const defaultLogoContainer = wrapper.find('.default-logo');
expect(defaultLogoContainer).toBeTruthy();
const imageContainer = wrapper.find('.profile-picture');
expect(imageContainer.exists()).toBeFalsy();
});
it('should render Symphony logo if Symphony default image provided', () => {
const logo = './default.png';
ipcRenderer.send(IPC_RENDERER_NOTIFICATION_DATA_CHANNEL, {

View File

@ -41,7 +41,7 @@ interface INotificationState {
company: string;
body: string;
image: string;
icon: string;
icon: string | undefined;
id: number;
color: string;
flash: boolean;
@ -263,11 +263,11 @@ export default class NotificationComp extends React.Component<
* Renders image if provided otherwise renders symphony logo
* @param imageUrl
*/
private renderImage(imageUrl: string): JSX.Element | undefined {
private renderImage(imageUrl: string | undefined): JSX.Element | undefined {
let imgClass = 'default-logo';
let url = '../renderer/assets/notification-symphony-logo.svg';
let alt = 'Symphony logo';
const isDefaultUrl = imageUrl.includes('default.png');
const isDefaultUrl = imageUrl && imageUrl.includes('default.png');
const shouldDisplayBadge = !!imageUrl && !isDefaultUrl;
if (imageUrl && !isDefaultUrl) {
imgClass = 'profile-picture';