This commit is contained in:
Huong Nguyen
2025-11-20 13:20:24 +07:00
8 changed files with 34 additions and 19 deletions
+2
View File
@@ -69,6 +69,7 @@ $string['disallowed'] = 'Locked off';
$string['editmessages'] = 'Edit messages';
$string['emailtagline'] = 'This is a copy of a message sent to you on the site {$a->sitename}. Go to <a href="{$a->url}">{$a->url}</a> to reply.';
$string['enabled'] = 'Enabled';
$string['enablenotificationplugin'] = 'Enable notification plugin: {$a}';
$string['errorcallingprocessor'] = 'Error calling defined output';
$string['errorconversationdoesnotexist'] = 'Conversation does not exist';
$string['errormessagetoolong'] = 'The message is longer than the maximum allowed.';
@@ -155,6 +156,7 @@ $string['page-message-x'] = 'Any message pages';
$string['participants'] = 'Participants';
$string['pendingcontactrequests'] = 'There are {$a} pending contact requests';
$string['permitted'] = 'Permitted';
$string['preference'] = 'Preference';
$string['privacy'] = 'Privacy';
$string['privacy_desc'] = 'You can restrict who can message you';
$string['privacy:metadata:core_favourites'] = 'The conversations starred by the user';
+11 -2
View File
@@ -75,6 +75,8 @@ class core_message_renderer extends plugin_renderer_base {
public function manage_messageoutputs($processors) {
// Display the current workflows
$table = new html_table();
$table->caption = get_string('messageoutputs', 'message');
$table->captionhide = true;
$table->attributes['class'] = 'admintable table generaltable table-hover';
$table->data = array();
$table->head = array(
@@ -90,7 +92,11 @@ class core_message_renderer extends plugin_renderer_base {
$row = new html_table_row();
$row->attributes['class'] = 'messageoutputs';
$name = new html_table_cell(get_string('pluginname', 'message_'.$processor->name));
$pluginname = get_string('pluginname', 'message_' . $processor->name);
$name = new html_table_cell($pluginname);
$name->header = true;
$name->attributes['class'] = 'fw-normal';
$name->attributes['scope'] = 'row';
$enable = new html_table_cell();
if (!$processor->available) {
$enable->text = html_writer::nonempty_tag('span', get_string('outputnotavailable', 'message'),
@@ -98,7 +104,10 @@ class core_message_renderer extends plugin_renderer_base {
);
} else {
$enable->text = html_writer::checkbox($processor->name, $processor->id, $processor->enabled, '',
array('id' => $processor->name)
[
'id' => $processor->name,
'aria-label' => get_string('enablenotificationplugin', 'message', $pluginname),
]
);
}
// Settings
@@ -70,13 +70,15 @@
}
}}
<div class="preferences-page-container">
<h2>{{#str}} managemessageoutputs, message {{/str}}</h2>
<h2 id="defaultnotificationprefsheading">{{#str}} managemessageoutputs, message {{/str}}</h2>
<div class="preferences-container">
<table class="table table-hover preference-table">
<table class="table table-hover preference-table" aria-labelledby="defaultnotificationprefsheading">
<thead>
<tr>
<th></th>
<th>
<span class="visually-hidden">{{#str}}preference, message{{/str}}</span>
</th>
<th>{{#str}} enabled, core_message {{/str}}</th>
{{#processors}}
<th data-processor-name="{{name}}">{{{displayname}}}</th>
@@ -98,8 +100,7 @@
class="form-check-input provider_enabled"
{{#enabled}}checked{{/enabled}}
>
<label for="{{{enabledsetting}}}" class="form-check-label"
title="{{enabledlabel}}">
<label for="{{{enabledsetting}}}" class="form-check-label">
<span class="accesshide">{{enabledlabel}}</span>
</label>
</div>
@@ -116,8 +117,7 @@
class="form-check-input enabled_message_setting"
{{#enabled}}checked{{/enabled}}
>
<label for="{{{enabledsetting}}}" class="form-check-label"
title="{{enabledlabel}}">
<label for="{{{enabledsetting}}}" class="form-check-label">
{{#str}} enabled, core_message {{/str}}
</label>
</div>
@@ -130,8 +130,7 @@
class="form-check-input locked_message_setting"
{{#locked}}checked{{/locked}}
>
<label for="{{{lockedsetting}}}" class="form-check-label"
title="{{lockedlabel}}">
<label for="{{{lockedsetting}}}" class="form-check-label">
{{#str}} forced, core_message {{/str}}
</label>
</div>
@@ -69,7 +69,7 @@
}
}}
<div class="preferences-page-container">
<h2>{{#str}} notificationpreferences, message {{/str}}</h2>
<h2 id="notificationpreferencesheading">{{#str}} notificationpreferences, message {{/str}}</h2>
<div class="checkbox-container" data-region="disable-notification-container">
<input id="disable-notifications"
type="checkbox"
@@ -79,10 +79,12 @@
{{> core/loading }}
</div>
<div class="preferences-container {{#disableall}}disabled{{/disableall}}" data-user-id="{{userid}}">
<table class="table preference-table">
<table class="table preference-table" aria-labelledby="notificationpreferencesheading">
<thead>
<tr>
<th>{{{displayname}}}</th>
<th scope="col">
<span class="visually-hidden">{{#str}}preference, message{{/str}}</span>
</th>
{{#processors}}
{{> message/notification_preferences_processor }}
{{/processors}}
@@ -48,7 +48,7 @@
}
}}
<tr class="preference-row" data-region="preference-row" data-preference-key="{{{preferencekey}}}">
<td class="preference-name">{{{displayname}}}</td>
<th class="preference-name fw-normal" scope="row">{{{displayname}}}</th>
{{#processors}}
<td {{^userconfigured}}class="disabled"{{/userconfigured}} data-processor-name="{{name}}">
{{#supportsprocessor}}
@@ -66,8 +66,8 @@
{{#disableall}} disabled="true" {{/disableall}}
{{#enabled}}checked{{/enabled}}
>
<label for="{{{preferencekey}}}_{{{name}}}" class="form-check-label"
title="{{enabledlabel}}" >
<label for="{{{preferencekey}}}_{{{name}}}" class="visually-hidden">
{{enabledlabel}}
</label>
</div>
</div>
@@ -41,7 +41,7 @@
"contextid": 3
}
}}
<th {{^userconfigured}}class="unconfigured"{{/userconfigured}} data-processor-name="{{name}}">
<th {{^userconfigured}}class="unconfigured"{{/userconfigured}} data-processor-name="{{name}}" scope="col">
{{#hassettings}}
<a href="#"
data-processor-setting
@@ -90,6 +90,7 @@ Feature: Manage notification preferences - Email
Then the field "message_provider_mod_assign_assign_notification_email" matches value "0"
And I should not see "Enabled" in the "Assignment notifications" "table_row"
@accessibility
Scenario: Lock email notifications for Forum providers
Given I log in as "admin"
When I navigate to "Messaging > Notification settings" in site administration
@@ -109,6 +110,7 @@ Feature: Manage notification preferences - Email
And I click on "Notification preferences" "link" in the "#page-content" "css_element"
And I should see "Locked on" in the "[data-preference-key=message_provider_mod_forum_posts]" "css_element"
And I should see "Locked off" in the "[data-preference-key=message_provider_mod_forum_digests]" "css_element"
And the page should meet accessibility standards with "best-practice" extra tests
Scenario: User can disable notification preferences
Given the following "courses" exist:
@@ -40,7 +40,7 @@ Feature: To be able to see and save user message preferences as admin
And "[data-processor-name='email']" "css_element" should not exist
And "[data-processor-name='airnotifier']" "css_element" should exist
@javascript
@javascript @accessibility
Scenario: An admin can set the default notification preferences
Given I log in as "admin"
And I navigate to "Messaging > Notification settings" in site administration
@@ -54,6 +54,7 @@ Feature: To be able to see and save user message preferences as admin
| mod_feedback_submission_enabled[email] | 1 |
| mod_feedback_submission_locked[email] | 1 |
| mod_feedback_message_disable | 0 |
And the "region-main" "region" should meet accessibility standards with "best-practice" extra tests
And I log in as "student1"
And I follow "Preferences" in the user menu
When I click on "Notification preferences" "link" in the "#page-content" "css_element"