kaltura / moodle_plugin

8 stars 37 forks source link

Fix UX issue with submit capability in kaltura assignment #380

Open estevebadia opened 2 years ago

estevebadia commented 2 years ago

The mod/kalvidassign:submit capability allows students to submit videos in assignments (kalvidassign module). By default, students have this capability and teachers don't. This permission is enforced in mod/kalvidassign/lti_launch.php. However, the mod/kalvidassign/view.php file renders the submission preview and submit buttons regardless of the user permissions. Thus, a user without the permission (eg. a teacher) sees the submit buttons but when clicking on them the LTI popup window shows an error requiring the permission.

This PR improves the module usability for users without this permission by not showing the submit buttons if they don't have the capabaility that will anyway be enforced later.

Diff note: The PR is just two lines of code (the if and the closing brace), but all lines within the if block are also affected due to the indent.

History note: Digging in the source history, the initial code came with a similar (but not equal!) check: it only showed the submit buttons if the user did NOT have the permission mod/gradesubmission. That resulted in a bug for users with both submit and gradesubmission permissions because they could not submit their video. Then in commit cace68e6ce0e726edabdf49cb0b2e5b0e363294e the check was removed in order to fix the bug, but introducing this UX issue. With this PR, the case of students but locally teachers works fine since they see both submit and grade buttons.