diff --git a/src/addons/messages/pages/discussion/discussion.scss b/src/addons/messages/pages/discussion/discussion.scss index b7a8a53df..8a1e2dd70 100644 --- a/src/addons/messages/pages/discussion/discussion.scss +++ b/src/addons/messages/pages/discussion/discussion.scss @@ -35,9 +35,21 @@ padding: 0px; .core-bar-button-image { + --userpicture-padding: 4px; @include margin-horizontal(null, 6px); } + // Group avatar. + img.core-bar-button-image { + padding: var(--userpicture-padding); + width: var(--core-header-toolbar-button-image-size); + height: var(--core-header-toolbar-button-image-size); + max-width: var(--core-header-toolbar-button-image-size); + max-height: var(--core-header-toolbar-button-image-size); + border-radius: var(--core-avatar-radius); + display: block; + } + core-format-text { overflow: hidden; text-overflow: ellipsis; diff --git a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png index fca711d9c..961648d44 100644 Binary files a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png and b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png differ diff --git a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png index 418759cbf..80a903af6 100644 Binary files a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png and b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png differ diff --git a/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png index 2c3a9cfe5..a9133c576 100644 Binary files a/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png and b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png differ diff --git a/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.png b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.png index 537c64e4c..d56626909 100644 Binary files a/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.png and b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.png differ diff --git a/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_39.png b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_39.png index 895e1dbef..c36de5e70 100644 Binary files a/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_39.png and b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_39.png differ diff --git a/src/addons/notifications/notifications.scss b/src/addons/notifications/notifications.scss index 305269884..4f4468bdf 100644 --- a/src/addons/notifications/notifications.scss +++ b/src/addons/notifications/notifications.scss @@ -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); } diff --git a/src/addons/notifications/services/notifications.ts b/src/addons/notifications/services/notifications.ts index aeaf0660f..c25c81fa1 100644 --- a/src/addons/notifications/services/notifications.ts +++ b/src/addons/notifications/services/notifications.ts @@ -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>(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; diff --git a/src/core/components/tests/user-avatar.test.ts b/src/core/components/tests/user-avatar.test.ts index a8c085b74..a68f951a9 100644 --- a/src/core/components/tests/user-avatar.test.ts +++ b/src/core/components/tests/user-avatar.test.ts @@ -25,9 +25,9 @@ describe('CoreUserAvatarComponent', () => { // Assert. expect(nativeElement.innerHTML.trim()).not.toHaveLength(0); - const image = nativeElement.querySelector('img'); - expect(image).not.toBeNull(); - expect(image?.src).toEqual(document.location.href + 'assets/img/user-avatar.png'); + const initials = nativeElement.querySelector('.userinitials'); + expect(initials).not.toBeNull(); + expect(initials?.getAttribute('data-initials')?.trim()).toEqual('UNK'); }); }); diff --git a/src/core/components/user-avatar/core-user-avatar.html b/src/core/components/user-avatar/core-user-avatar.html index cb5b79b00..76c6425ec 100644 --- a/src/core/components/user-avatar/core-user-avatar.html +++ b/src/core/components/user-avatar/core-user-avatar.html @@ -7,20 +7,15 @@
- {{ initials }} + [title]="'core.pictureof' | translate:{$a: fullname}" (ariaButtonClick)="gotoProfile($event)" [attr.data-initials]="initials">
-