MOBILE-4579 notifications: Avoid showing user avatar from customdata
parent
d0c0b83296
commit
33d6d169f9
|
@ -34,13 +34,14 @@
|
||||||
img {
|
img {
|
||||||
width: var(--icon-size);
|
width: var(--icon-size);
|
||||||
height: var(--icon-size);
|
height: var(--icon-size);
|
||||||
|
padding: 4px;
|
||||||
}
|
}
|
||||||
ion-icon {
|
ion-icon {
|
||||||
font-size: var(--icon-size);
|
font-size: var(--icon-size);
|
||||||
}
|
}
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
background: var(--background-color);
|
background: var(--background-color);
|
||||||
border-radius: var(--mdl-shape-borderRadius-xs);
|
border-radius: var(--core-avatar-radius);
|
||||||
@include margin(6px, 8px, 6px, 0px);
|
@include margin(6px, 8px, 6px, 0px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ export class AddonNotificationsProvider {
|
||||||
notification.notif = 1;
|
notification.notif = 1;
|
||||||
notification.read = notification.timeread > 0;
|
notification.read = notification.timeread > 0;
|
||||||
|
|
||||||
if (typeof notification.customdata == 'string') {
|
if (typeof notification.customdata === 'string') {
|
||||||
notification.customdata = CoreTextUtils.parseJSON<Record<string, string|number>>(notification.customdata, {});
|
notification.customdata = CoreTextUtils.parseJSON<Record<string, string|number>>(notification.customdata, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,9 +142,6 @@ export class AddonNotificationsProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const imgUrl = notification.customdata?.notificationpictureurl || notification.customdata?.notificationiconurl;
|
|
||||||
notification.imgUrl = imgUrl ? String(imgUrl) : undefined;
|
|
||||||
|
|
||||||
if (notification.useridfrom > 0) {
|
if (notification.useridfrom > 0) {
|
||||||
// Try to get the profile picture of the user.
|
// Try to get the profile picture of the user.
|
||||||
try {
|
try {
|
||||||
|
@ -155,6 +152,12 @@ export class AddonNotificationsProvider {
|
||||||
} catch {
|
} catch {
|
||||||
// Error getting user. This can happen if device is offline or the user is deleted.
|
// Error getting user. This can happen if device is offline or the user is deleted.
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Do not assign avatar for newlogin notifications.
|
||||||
|
if (notification.eventtype !== 'newlogin') {
|
||||||
|
const imgUrl = notification.customdata?.notificationpictureurl || notification.customdata?.notificationiconurl;
|
||||||
|
notification.imgUrl = imgUrl ? String(imgUrl) : undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return notification;
|
return notification;
|
||||||
|
|
|
@ -79,6 +79,8 @@
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
width: calc(var(--core-avatar-size) - var(--userpicture-padding) - var(--userpicture-padding));
|
width: calc(var(--core-avatar-size) - var(--userpicture-padding) - var(--userpicture-padding));
|
||||||
height: calc(var(--core-avatar-size) - var(--userpicture-padding) - var(--userpicture-padding));
|
height: calc(var(--core-avatar-size) - var(--userpicture-padding) - var(--userpicture-padding));
|
||||||
|
min-height: 0px;
|
||||||
|
min-width: 0px;
|
||||||
font-size: calc(var(--core-avatar-size)*0.3);
|
font-size: calc(var(--core-avatar-size)*0.3);
|
||||||
margin: var(--userpicture-padding);
|
margin: var(--userpicture-padding);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue