diff --git a/message/classes/helper.php b/message/classes/helper.php index 39b7a354a1b..73d5a545131 100644 --- a/message/classes/helper.php +++ b/message/classes/helper.php @@ -626,6 +626,7 @@ class helper { 'isdrawer' => $isdrawer, 'showemojipicker' => !empty($CFG->allowemojipicker), 'messagemaxlength' => api::MESSAGE_MAX_LENGTH, + 'caneditownmessageprofile' => has_capability('moodle/user:editownmessageprofile', \context_system::instance()) ]; if ($sendtouser || $conversationid) { diff --git a/message/output/popup/lib.php b/message/output/popup/lib.php index dd3964e59bc..5bb80e371c2 100644 --- a/message/output/popup/lib.php +++ b/message/output/popup/lib.php @@ -47,12 +47,14 @@ function message_popup_render_navbar_output(\renderer_base $renderer) { $enabled = \core_message\api::is_processor_enabled("popup"); if ($enabled) { $unreadcount = \message_popup\api::count_unread_popup_notifications($USER->id); + $caneditownmessageprofile = has_capability('moodle/user:editownmessageprofile', context_system::instance()); + $preferencesurl = $caneditownmessageprofile ? new moodle_url('/message/notificationpreferences.php') : null; $context = [ 'userid' => $USER->id, 'unreadcount' => $unreadcount, 'urls' => [ 'seeall' => (new moodle_url('/message/output/popup/notifications.php'))->out(), - 'preferences' => (new moodle_url('/message/notificationpreferences.php', ['userid' => $USER->id]))->out(), + 'preferences' => $preferencesurl ? $preferencesurl->out() : null, ], ]; $output .= $renderer->render_from_template('message_popup/notification_popover', $context); diff --git a/message/output/popup/templates/notification_popover.mustache b/message/output/popup/templates/notification_popover.mustache index 5c728cccea4..beee4fc6dfc 100644 --- a/message/output/popup/templates/notification_popover.mustache +++ b/message/output/popup/templates/notification_popover.mustache @@ -62,11 +62,12 @@ {{#pix}} t/markasread, core {{/pix}} {{> core/loading }} - - {{#pix}} i/settings, core {{/pix}} - + {{# urls.preferences }} + + {{#pix}} i/settings, core {{/pix}} + {{/ urls.preferences }} {{/headeractions}} {{$content}} diff --git a/message/templates/message_drawer_view_overview_header.mustache b/message/templates/message_drawer_view_overview_header.mustache index b633815480d..ef479ea53f2 100644 --- a/message/templates/message_drawer_view_overview_header.mustache +++ b/message/templates/message_drawer_view_overview_header.mustache @@ -49,6 +49,7 @@ + {{#caneditownmessageprofile}}
+ {{/caneditownmessageprofile}}