Skip to content
Permalink
Browse files

Merge branch 'MDL-59195_assign_comment_permissions_33' of git://githu…

…b.com/davosmith/moodle into MOODLE_33_STABLE
  • Loading branch information
danpoltawski committed Aug 29, 2017
2 parents 733222c + 0d5f10d commit b3abfa22e03d671bbff063ef1901a702eff81b24
@@ -48,15 +48,6 @@ function assignsubmission_comments_comment_validate(stdClass $options) {
if ($assignment->get_instance()->id != $submission->assignment) {
throw new comment_exception('invalidcontext');
}
$canview = false;
if ($submission->userid) {
$canview = $assignment->can_view_submission($submission->userid);
} else {
$canview = $assignment->can_view_group_submission($submission->groupid);
}
if (!$canview) {
throw new comment_exception('nopermissiontocomment');
}
return true;
}
@@ -69,7 +69,6 @@ public function view_summary(stdClass $submission, & $showviewlink) {
$options->displaycancel = true;
$comment = new comment($options);
$comment->set_view_permission(true);
$o = $this->assignment->get_renderer()->container($comment->output(true), 'commentscontainer');
return $o;
@@ -0,0 +1,26 @@
@mod @mod_assign
Feature: Switch role does not cause an error message in assignsubmission_comments

Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username |
| teacher1 |
And the following "course enrolments" exist:
| course | user | role |
| C1 | teacher1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment |
| Description | This is the description text |
| Students submit in groups | Yes |

Scenario: I switch role to student and an error doesn't occur
When I follow "Switch role to..." in the user menu
And I press "Student"
And I follow "Test assignment"
Then I should see "This is the description text"

0 comments on commit b3abfa2

Please sign in to comment.
You can’t perform that action at this time.