MDL-73097 Calendar: Hide event type if user cannot change it

This commit is contained in:
stevando
2022-09-06 09:53:38 +08:00
committed by Simey Lameze
parent 952d9e9f18
commit 73bc430e17
2 changed files with 9 additions and 17 deletions
@@ -79,10 +79,6 @@ trait eventtype {
$mform->addElement('hidden', 'eventtype');
$mform->setType('eventtype', PARAM_TEXT);
$mform->setDefault('eventtype', 'user');
// Render a static element to tell the user what type of event will
// be created.
$mform->addElement('static', 'staticeventtype', get_string('eventkind', 'calendar'), $options['user']);
return;
} else {
$mform->addElement('select', 'eventtype', get_string('eventkind', 'calendar'), $options);
+9 -13
View File
@@ -230,27 +230,23 @@ Feature: Perform basic calendar functionality
And "Course 3" "autocomplete_suggestions" should exist
@javascript
Scenario: Students can only see user event type by default.
Scenario: Students can not see event type by default.
Given I log in as "student1"
And I am viewing site calendar
When I click on "New event" "button"
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
And I am on "Course 1" course homepage
And I follow "Full calendar"
When I click on "New event" "button"
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
Then "Type of event" "select" should not exist
And I click on "Close" "button" in the "New event" "dialogue"
And I log out
Given I log in as "admin"
# Login as admin to set the adminseesall = 1.
And I log in as "admin"
And I navigate to "Appearance > Calendar" in site administration
And I set the field "Admins see all" to "1"
And I press "Save changes"
And I log out
Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Full calendar"
When I click on "New event" "button"
Then I should see "User" in the "div#fitem_id_staticeventtype" "css_element"
# Login back as student.
And I log in as "student1"
And I am viewing site calendar
And I click on "New event" "button"
And "Type of event" "select" should not exist
@javascript @accessibility
Scenario: The calendar page must be accessible