Merge branch 'MDL-71168' of git://github.com/paulholden/moodle

This commit is contained in:
Andrew Nicols 2021-04-28 10:48:02 +08:00
commit 679fcbfeaf
4 changed files with 29 additions and 18 deletions

View File

@ -1,2 +1,2 @@
define ("report_participation/participants",["exports","jquery","core/custom_interaction_events","core/modal_events","core/notification","core_user/local/participants/bulkactions"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=g(b);c=g(c);d=g(d);e=g(e);function g(a){return a&&a.__esModule?a:{default:a}}var h={bulkActionSelect:"#formactionid",bulkUserSelectedCheckBoxes:"input[data-togglegroup^='participants-table']:checked",participantsForm:"#participantsform"};a.init=function init(){var a=document.querySelector(h.participantsForm),g=function(){c.default.define(h.bulkActionSelect,[c.default.events.accessibleChange]);(0,b.default)(h.bulkActionSelect).on(c.default.events.accessibleChange,function(b){var c=b.target.value,g=a.querySelectorAll(h.bulkUserSelectedCheckBoxes);if(-1!==c.indexOf("#")){b.preventDefault();var j=[];g.forEach(function(a){j.push(a.getAttribute("name").replace("user",""))});if("#messageselect"===c){(0,f.showSendMessage)(j).then(function(b){b.getRoot().on(d.default.hidden,function(){var b=a.querySelector(h.bulkActionSelect);i(b);b.focus()});return b}).catch(e.default.exception)}}else if(""!==c&&g.length){b.target.form().submit()}i(b.target)})},i=function(a){a.value=""};g()}});
define ("report_participation/participants",["exports","jquery","core/custom_interaction_events","core/modal_events","core/notification","core_user/local/participants/bulkactions"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=g(b);c=g(c);d=g(d);e=g(e);function g(a){return a&&a.__esModule?a:{default:a}}var h={bulkActionSelect:"#formactionid",bulkUserSelectedCheckBoxes:"input[data-togglegroup^='participants-table'][data-toggle='slave']:checked",participantsForm:"#participantsform"};a.init=function init(){var a=document.querySelector(h.participantsForm),g=function(){c.default.define(h.bulkActionSelect,[c.default.events.accessibleChange]);(0,b.default)(h.bulkActionSelect).on(c.default.events.accessibleChange,function(b){var c=b.target.value,g=a.querySelectorAll(h.bulkUserSelectedCheckBoxes);if(-1!==c.indexOf("#")){b.preventDefault();var j=[];g.forEach(function(a){j.push(a.getAttribute("name").replace("user",""))});if("#messageselect"===c){(0,f.showSendMessage)(j).then(function(b){b.getRoot().on(d.default.hidden,function(){var b=a.querySelector(h.bulkActionSelect);i(b);b.focus()});return b}).catch(e.default.exception)}}else if(""!==c&&g.length){b.target.form().submit()}i(b.target)})},i=function(a){a.value=""};g()}});
//# sourceMappingURL=participants.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ import {showSendMessage} from 'core_user/local/participants/bulkactions';
const Selectors = {
bulkActionSelect: "#formactionid",
bulkUserSelectedCheckBoxes: "input[data-togglegroup^='participants-table']:checked",
bulkUserSelectedCheckBoxes: "input[data-togglegroup^='participants-table'][data-toggle='slave']:checked",
participantsForm: '#participantsform',
};

View File

@ -20,21 +20,31 @@ Feature: Use the particiaption report to message groups of students
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book name |
| Description | Test book |
And I follow "Test book name"
And I set the following fields to these values:
| Chapter title | Test chapter |
| Content | Test chapter content |
And I log out
And the following "activity" exists:
| course | C1 |
| activity | book |
| name | Test book name |
| description | Test book |
| idnumber | book1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test book name"
And I log out
Scenario: Message all students from the participation report
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports > Course participation" in current page administration
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
When I click on "select-all-participants" "checkbox"
And I choose "Send a message" from the participants page bulk action menu
Then "Send message to 3 people" "dialogue" should exist
And I set the field "Message" to "Hi there"
And I press "Send message to 3 people"
And I should see "Message sent to 3 people"
Scenario: Message students who have not participated in book
Given I log in as "teacher1"
And I am on "Course 1" course homepage
@ -47,13 +57,14 @@ Feature: Use the particiaption report to message groups of students
And I should see "No" in the "Student 3" "table_row"
When I press "Select all 'No'"
And I choose "Send a message" from the participants page bulk action menu
Then I should see "Send message to 2 people"
Then "Send message to 2 people" "dialogue" should exist
And I set the field "Message" to "Hi there"
And I press "Send message to 2 people"
And I should see "Message sent to 2 people"
Scenario: Ensure no message options when messaging is disabled
Given I log in as "admin"
And I set the following administration settings values:
Given the following config values are set as admin:
| messaging | 0 |
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Reports > Course participation" in current page administration
@ -61,4 +72,4 @@ Feature: Use the particiaption report to message groups of students
And I set the field "roleid" to "Student"
And I press "Go"
Then I should not see "With selected users..."
And I should not see "Select all"
And "select-all-participants" "checkbox" should not exist