Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Service/CirclesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,11 @@ public function checkThatCircleIsNotFull(Circle $circle) {
$circle->getUniqueId(), Member::LEVEL_MEMBER, true
);

$limit = $circle->getSetting('members_limit');
$limit = (int) $circle->getSetting('members_limit');
if ($limit === -1) {
return;
}
if ($limit === 0 || $limit === '' || $limit === null) {
if ($limit === 0) {
$limit = $this->configService->getAppValue(ConfigService::CIRCLES_MEMBERS_LIMIT);
}

Expand Down
16 changes: 13 additions & 3 deletions lib/Service/GroupsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class GroupsService {
/** @var IUserManager */
private $userManager;

/** @var ConfigService */
private $configService;

/** @var CirclesRequest */
private $circlesRequest;

Expand All @@ -76,6 +79,7 @@ class GroupsService {
* @param IL10N $l10n
* @param IGroupManager $groupManager
* @param IUserManager $userManager
* @param ConfigService $configService
* @param CirclesRequest $circlesRequest
* @param MembersRequest $membersRequest
* @param CirclesService $circlesService
Expand All @@ -84,14 +88,15 @@ class GroupsService {
*/
public function __construct(
$userId, IL10N $l10n, IGroupManager $groupManager, IUserManager $userManager,
CirclesRequest $circlesRequest,
ConfigService $configService, CirclesRequest $circlesRequest,
MembersRequest $membersRequest, CirclesService $circlesService,
EventsService $eventsService, MiscService $miscService
) {
$this->userId = $userId;
$this->l10n = $l10n;
$this->groupManager = $groupManager;
$this->userManager = $userManager;
$this->configService = $configService;
$this->circlesRequest = $circlesRequest;
$this->membersRequest = $membersRequest;
$this->circlesService = $circlesService;
Expand Down Expand Up @@ -132,8 +137,13 @@ public function linkGroup($circleUniqueId, $groupId) {
$count++;
}

if ($count > $circle->getSetting('members_limit')) {
throw new \Exception('Group contains too many members');
$limit = (int) $circle->getSetting('members_limit');
if ($limit === 0) {
$limit = $this->configService->getAppValue(ConfigService::CIRCLES_MEMBERS_LIMIT);
}

if ($limit !== -1 && $count > $limit) {
throw new \Exception($this->l10n->t('Group contains too many members'));
}

$group = $this->getFreshNewMember($circleUniqueId, $groupId);
Expand Down