From b3205906688c63a99abdec97111e41f2dad6f2e8 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 28 Oct 2015 11:55:16 +0800 Subject: [PATCH 1/2] MDL-51939 mod_forum: Fix groupid data on upgrade This upgrade step addresses issues identified in MDL-51939 where the groupid was incorrectly set. The issue itself is not present in 2.9, but this upgrade step is required to correct any incorrect data. --- mod/forum/db/upgrade.php | 7 +++++++ mod/forum/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index ec874dfa7ee..c7248d31979 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -242,6 +242,13 @@ function xmldb_forum_upgrade($oldversion) { // Moodle v2.9.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2015051102) { + // Groupid = 0 is never valid. + $DB->set_field('forum_discussions', 'groupid', -1, array('groupid' => 0)); + + // Forum savepoint reached. + upgrade_mod_savepoint(true, 2015051102, 'forum'); + } return true; } diff --git a/mod/forum/version.php b/mod/forum/version.php index 2caf094cb05..b6c95cfb4bc 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2015051101; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2015051102; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2015050500; // Requires this Moodle version $plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics) From 942ec23dd1d7dea6a59cf5eaf6da128695b9d10c Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 29 Oct 2015 12:54:45 +0100 Subject: [PATCH 2/2] MDL-51939 mod_forum: all participants discussions are viewed by students Added scenario to verify that "all participants" discussions, under separate-groups mode are, by default, visible for students. --- .../tests/behat/separate_group_discussions.feature | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mod/forum/tests/behat/separate_group_discussions.feature b/mod/forum/tests/behat/separate_group_discussions.feature index 2a99b8c4ef9..30e5b506924 100644 --- a/mod/forum/tests/behat/separate_group_discussions.feature +++ b/mod/forum/tests/behat/separate_group_discussions.feature @@ -239,3 +239,16 @@ Feature: Posting to all groups in a separate group discussion is restricted to u And the "Group" select box should contain "Group A" And the "Group" select box should contain "Group B" And I should see "Post a copy to all groups" + + Scenario: Students can view all participants discussions in separate groups mode + Given I log in as "teacher1" + And I follow "Course 1" + When I add a new discussion to "Standard forum name" forum with: + | Subject | Forum post to all participants | + | Message | This is the body | + | Group | All participants | + And I log out + And I log in as "student1" + And I follow "Course 1" + And I follow "Standard forum name" + Then I should see "Forum post to all participants"