Incorrect scoping for user group searches
authorAlexander Ebert <ebert@woltlab.com>
Wed, 27 Mar 2019 16:41:08 +0000 (17:41 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 27 Mar 2019 16:41:08 +0000 (17:41 +0100)
See WoltLab/com.woltlab.wbb#325

wcfsetup/install/files/lib/data/user/UserAction.class.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php

index fe67f7ad93165e9922623923689df464a86df8f0..d863d33249ffff2441ef8b795f5bc3a2d8c110c0 100644 (file)
@@ -512,7 +512,13 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
                $list = [];
                
                if ($this->parameters['data']['includeUserGroups']) {
-                       $accessibleGroups = UserGroup::getMentionableGroups();
+                       if ($this->parameters['data']['scope'] === 'mention') {
+                               $accessibleGroups = UserGroup::getMentionableGroups();
+                       }
+                       else {
+                               $accessibleGroups = UserGroup::getAllGroups();
+                       }
+                       
                        foreach ($accessibleGroups as $group) {
                                if (!empty($this->parameters['data']['restrictUserGroupIDs']) && !in_array($group->groupID, $this->parameters['data']['restrictUserGroupIDs'])) {
                                        continue;
index 81db49c650d0538b695995f0e2be24e3c9b78fcb..abf5f314c6644a45b693921c01a226fead8740dc 100644 (file)
@@ -442,4 +442,14 @@ class UserGroup extends DatabaseObject implements ITitledObject {
                
                return $groups;
        }
+       
+       /**
+        * @return UserGroup[]
+        * @since 5.2
+        */
+       public static function getAllGroups() {
+               self::getCache();
+               
+               return self::$cache['groups'];
+       }
 }