Merge branch 'MDL-83558-main' of https://github.com/andrewgos/moodle
This commit is contained in:
@@ -385,14 +385,21 @@ class discussion_list {
|
||||
|
||||
if ($forum->is_in_group_mode() && !$capabilitymanager->can_access_all_groups($user)) {
|
||||
if ($groupid === null) {
|
||||
if (!$capabilitymanager->can_post_to_my_groups($user)) {
|
||||
$isvisiblegroupsmode = $forum->get_effective_group_mode() == VISIBLEGROUPS;
|
||||
$isgroupmember = !empty(groups_get_user_groups($forum->get_course_id(), $user->id)[0]);
|
||||
|
||||
if (
|
||||
!$capabilitymanager->can_post_to_my_groups($user)
|
||||
&& $isvisiblegroupsmode
|
||||
&& $isgroupmember
|
||||
) {
|
||||
$notifications[] = (new notification(
|
||||
get_string('cannotadddiscussiongroup', 'mod_forum'),
|
||||
get_string('cannotadddiscussionall', 'mod_forum'),
|
||||
\core\output\notification::NOTIFY_WARNING
|
||||
))->set_show_closebutton();
|
||||
} else {
|
||||
$notifications[] = (new notification(
|
||||
get_string('cannotadddiscussionall', 'mod_forum'),
|
||||
get_string('cannotadddiscussiongroup', 'mod_forum'),
|
||||
\core\output\notification::NOTIFY_WARNING
|
||||
))->set_show_closebutton();
|
||||
}
|
||||
|
||||
@@ -193,14 +193,14 @@ Feature: Posting to all groups in a separate group discussion is restricted to u
|
||||
When I am on the "Standard forum name" "forum activity" page logged in as student4
|
||||
Then I should see "All participants"
|
||||
And I should see "Initial Disc ALL"
|
||||
And I should see "You are not able to create a discussion"
|
||||
And I should see "You are not able to create a discussion because you are not a member of any group."
|
||||
And I should not see "Add discussion topic"
|
||||
|
||||
Scenario: Students in non-participation groups can see all group discussions, but not post.
|
||||
When I am on the "Standard forum name" "forum activity" page logged in as student3
|
||||
Then I should see "All participants"
|
||||
And I should see "Initial Disc ALL"
|
||||
And I should see "You are not able to create a discussion"
|
||||
And I should see "You are not able to create a discussion because you are not a member of any group."
|
||||
And I should not see "Add discussion topic"
|
||||
|
||||
Scenario: Students in multiple group can post in all of their group individually
|
||||
|
||||
@@ -259,7 +259,7 @@ Feature: Posting to all groups in a visible group discussion is restricted to us
|
||||
And I should see "Initial Disc G1"
|
||||
And I should see "Initial Disc G2"
|
||||
And I should see "Initial Disc G2"
|
||||
And I should see "You are not able to create a discussion"
|
||||
And I should see "You are not able to create a discussion because you are not a member of any group."
|
||||
And I should not see "Add discussion topic"
|
||||
|
||||
Scenario: Students in non-participation groups can see all discussions, but not post.
|
||||
@@ -271,5 +271,5 @@ Feature: Posting to all groups in a visible group discussion is restricted to us
|
||||
And I should see "Initial Disc G1"
|
||||
And I should see "Initial Disc G2"
|
||||
And I should see "Initial Disc G2"
|
||||
And I should see "You are not able to create a discussion"
|
||||
And I should see "You do not have permission to add a new discussion topic for all participants."
|
||||
And I should not see "Add discussion topic"
|
||||
|
||||
Reference in New Issue
Block a user