Skip to content

Commit

Permalink
MDL-82109 notes: include link to add site note if user has capability.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Jan 9, 2025
1 parent a843eab commit 477a160
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 5 additions & 3 deletions notes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,11 @@
$USER->id
);

} else { // Normal course.
$view = has_capability('moodle/notes:view', context_system::instance());
note_print_notes('<a name="sitenotes"></a>' . $strsitenotes, 0, $view, 0, $userid, NOTES_STATE_SITE, 0);
} else {
// Site course.
$addid = has_capability('moodle/notes:manage', $systemcontext) ? SITEID : 0;
$view = has_capability('moodle/notes:view', $systemcontext);
note_print_notes('<a name="sitenotes"></a>' . $strsitenotes, $addid, $view, 0, $userid, NOTES_STATE_SITE, 0);
echo '<a name="coursenotes"></a>';

if (!empty($userid)) {
Expand Down
16 changes: 16 additions & 0 deletions notes/tests/behat/site_notes.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@core @core_notes
Feature: Add notes to site users
In order to share information with other users
As an admin
I need to add notes to site user accounts

Scenario: Add a user site note
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
When I am on the "student1" "user > profile" page logged in as "admin"
And I follow "Notes"
And I follow "Add a new note"
And I set the field "Content" to "Student 1 needs to pick up his game"
And I press "Save changes"
Then I should see "Student 1 needs to pick up his game" in the ".notelist" "css_element"

0 comments on commit 477a160

Please sign in to comment.