aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/settings
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2021-10-15 09:26:47 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2021-10-15 09:26:47 +0000
commitcff86c5c6d469ddfed26b5bbe1e105f8f07c358f (patch)
tree3adcb02b991a8436f6d6059b289a4ffdc32affa5 /app/controllers/settings
parentb58c7b56f5a248dd8cc388d43eff24c39a1a5419 (diff)
align open groups config for my courses and notifications, fixes #328
Diffstat (limited to 'app/controllers/settings')
-rw-r--r--app/controllers/settings/notification.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/settings/notification.php b/app/controllers/settings/notification.php
index 1c2b198..12245f3 100644
--- a/app/controllers/settings/notification.php
+++ b/app/controllers/settings/notification.php
@@ -180,8 +180,10 @@ class Settings_NotificationController extends Settings_SettingsController
*/
public function open_action($id)
{
- $open = $this->config->MY_COURSES_OPEN_GROUPS;
- $open[$id] = true;
+ $open = $this->config->MY_COURSES_OPEN_GROUPS;
+ if (!in_array($id, $open)) {
+ $open[] = $id;
+ }
$this->config->store('MY_COURSES_OPEN_GROUPS', $open);
$this->redirect('settings/notification');
@@ -195,7 +197,7 @@ class Settings_NotificationController extends Settings_SettingsController
public function close_action($id)
{
$open = $this->config->MY_COURSES_OPEN_GROUPS;
- unset($open[$id]);
+ $open = array_diff($open, [$id]);
$this->config->store('MY_COURSES_OPEN_GROUPS', $open);
$this->redirect('settings/notification');