MOBILE-4579 notifications: Avoid showing user avatar from customdata
This commit is contained in:
		
							parent
							
								
									d0c0b83296
								
							
						
					
					
						commit
						33d6d169f9
					
				| @ -34,13 +34,14 @@ | ||||
|         img { | ||||
|             width: var(--icon-size); | ||||
|             height:  var(--icon-size); | ||||
|             padding: 4px; | ||||
|         } | ||||
|         ion-icon { | ||||
|             font-size: var(--icon-size); | ||||
|         } | ||||
|         padding: 0px; | ||||
|         background: var(--background-color); | ||||
|         border-radius: var(--mdl-shape-borderRadius-xs); | ||||
|         border-radius: var(--core-avatar-radius); | ||||
|         @include margin(6px, 8px, 6px, 0px); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -119,7 +119,7 @@ export class AddonNotificationsProvider { | ||||
|             notification.notif = 1; | ||||
|             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, {}); | ||||
|             } | ||||
| 
 | ||||
| @ -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) { | ||||
|                 // Try to get the profile picture of the user.
 | ||||
|                 try { | ||||
| @ -155,6 +152,12 @@ export class AddonNotificationsProvider { | ||||
|                 } catch { | ||||
|                     // 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; | ||||
|  | ||||
| @ -79,6 +79,8 @@ | ||||
|         font-weight: normal; | ||||
|         width: 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); | ||||
|         margin: var(--userpicture-padding); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user