From 499a04dc1af13fca44cb8eb6cf240d4a1657d40b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 31 Mar 2016 10:44:08 +0200 Subject: [PATCH 1/2] MOBILE-1509 notifications: Show user picture in notifications --- www/addons/notifications/controllers/list.js | 4 +++- www/addons/notifications/services/notifications.js | 9 +++++++-- www/addons/notifications/templates/list.html | 4 +++- www/core/lang/en.json | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/www/addons/notifications/controllers/list.js b/www/addons/notifications/controllers/list.js index 7c8fc21a8c4..b8b53bd2366 100644 --- a/www/addons/notifications/controllers/list.js +++ b/www/addons/notifications/controllers/list.js @@ -21,12 +21,14 @@ angular.module('mm.addons.notifications') * @ngdoc controller * @name mmaNotificationsListCtrl */ -.controller('mmaNotificationsListCtrl', function($scope, $mmUtil, $mmaNotifications, mmaNotificationsListLimit) { +.controller('mmaNotificationsListCtrl', function($scope, $mmUtil, $mmaNotifications, mmaNotificationsListLimit, + mmUserProfileState) { var readCount = 0, unreadCount = 0; $scope.notifications = []; + $scope.userStateName = mmUserProfileState; // Convenience function to get notifications. Get unread notifications first. function fetchNotifications(refresh) { diff --git a/www/addons/notifications/services/notifications.js b/www/addons/notifications/services/notifications.js index 6ef559a0ab8..20baaedc5a4 100644 --- a/www/addons/notifications/services/notifications.js +++ b/www/addons/notifications/services/notifications.js @@ -21,7 +21,7 @@ angular.module('mm.addons.notifications') * @ngdoc service * @name $mmaNotifications */ -.factory('$mmaNotifications', function($q, $log, $mmSite, $mmSitesManager, mmaNotificationsListLimit) { +.factory('$mmaNotifications', function($q, $log, $mmSite, $mmSitesManager, $mmUser, mmaNotificationsListLimit) { $log = $log.getInstance('$mmaNotifications'); @@ -42,6 +42,11 @@ angular.module('mm.addons.notifications') if (cid && cid[1]) { notification.courseid = cid[1]; } + + // Try to get the profile picture of the user. + $mmUser.getProfile(notification.useridfrom, notification.courseid, true).then(function(user) { + notification.profileimageurlfrom = user.profileimageurl; + }); }); } @@ -52,7 +57,7 @@ angular.module('mm.addons.notifications') */ function getNotificationsCacheKey() { return 'mmaNotifications:list'; - }; + } /** * Get notifications from site. diff --git a/www/addons/notifications/templates/list.html b/www/addons/notifications/templates/list.html index 8bfb9a5c9ea..4e880212088 100644 --- a/www/addons/notifications/templates/list.html +++ b/www/addons/notifications/templates/list.html @@ -4,7 +4,9 @@
-
+
+ {{ 'mm.core.pictureof' | translate:{$a: notification.userfromfullname} }} + {{ 'mm.core.pictureof' | translate:{$a: notification.userfromfullname} }}

{{notification.userfromfullname}}

{{notification.timecreated | mmDateDayOrTime}}

diff --git a/www/core/lang/en.json b/www/core/lang/en.json index 40b0a700f07..80f106652de 100644 --- a/www/core/lang/en.json +++ b/www/core/lang/en.json @@ -88,6 +88,7 @@ "openinbrowser": "Open in browser", "percentagenumber": "{{$a}}%", "phone": "Phone", + "pictureof": "Picture of {{$a}}", "previous": "Previous", "pulltorefresh": "Pull to refresh", "refresh": "Refresh", From 0ff8fcae377403bbbd213173ee450696196cb0bd Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 31 Mar 2016 10:44:50 +0200 Subject: [PATCH 2/2] MOBILE-1509 accessibility: Improve accessibility of user pictures --- www/addons/messages/templates/contacts.html | 2 +- www/addons/messages/templates/discussions.html | 4 ++-- www/addons/mod_assign/templates/index.html | 2 +- www/addons/mod_chat/templates/chat.html | 4 ++-- www/addons/mod_chat/templates/users.html | 2 +- www/addons/mod_forum/templates/discussionpost.html | 4 ++-- www/addons/mod_forum/templates/discussions.html | 4 ++-- www/addons/mod_glossary/templates/entry.html | 2 +- www/addons/notes/templates/list.html | 4 ++-- www/addons/participants/templates/list.html | 2 +- www/core/components/login/templates/sites.html | 2 +- www/core/components/sidemenu/templates/menu.html | 2 +- www/core/components/user/templates/profile.html | 4 ++-- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/www/addons/messages/templates/contacts.html b/www/addons/messages/templates/contacts.html index 0b0e11cf303..19547c6e75d 100644 --- a/www/addons/messages/templates/contacts.html +++ b/www/addons/messages/templates/contacts.html @@ -26,7 +26,7 @@

{{ 'mma.messages.type_' + contactType | translate }}

- + {{ 'mm.core.pictureof' | translate:{$a: contact.fullname} }}

{{ contact.fullname }}

diff --git a/www/addons/messages/templates/discussions.html b/www/addons/messages/templates/discussions.html index 09b69e695c5..e465bf562fb 100644 --- a/www/addons/messages/templates/discussions.html +++ b/www/addons/messages/templates/discussions.html @@ -5,8 +5,8 @@
  • - - + {{ 'mm.core.pictureof' | translate:{$a: disc.fullname} }} + {{ 'mm.core.pictureof' | translate:{$a: disc.fullname} }} {{disc.message.timecreated | mmDateDayOrTime}}

    {{disc.fullname}}

    diff --git a/www/addons/mod_assign/templates/index.html b/www/addons/mod_assign/templates/index.html index 194ddeb6638..69857131530 100644 --- a/www/addons/mod_assign/templates/index.html +++ b/www/addons/mod_assign/templates/index.html @@ -27,7 +27,7 @@

    {{ 'mma.mod_assign.cutoffdate' | translate }}

    - + {{ 'mm.core.pictureof' | translate:{$a: submission.userfullname} }}

    {{submission.userfullname}}

    {{submission.status}}

    {{ submission.timemodified * 1000 | mmFormatDate:"dfmediumdate" }}

    diff --git a/www/addons/mod_chat/templates/chat.html b/www/addons/mod_chat/templates/chat.html index a8e861252e4..539f573cc64 100644 --- a/www/addons/mod_chat/templates/chat.html +++ b/www/addons/mod_chat/templates/chat.html @@ -28,8 +28,8 @@

    - - + {{ 'mm.core.pictureof' | translate:{$a: message.userfullname} }} + {{ 'mm.core.pictureof' | translate:{$a: message.userfullname} }}

    {{ message.userfullname }}

    {{ message.message }} diff --git a/www/addons/mod_chat/templates/users.html b/www/addons/mod_chat/templates/users.html index 6513aa29292..f6ac576889c 100644 --- a/www/addons/mod_chat/templates/users.html +++ b/www/addons/mod_chat/templates/users.html @@ -8,7 +8,7 @@

    {{ 'mma.mod_chat.currentusers' | translate }}