diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-03-02 00:40:27 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-03-02 00:40:27 +0300 |
commit | 2e501897e7da7b6d9bda562f26d72f5d5761e268 (patch) | |
tree | c8a9a7f27f8b753fd758b66e6ecfc91560118d18 | |
parent | 8b7402d609222a197dc0cf92ef37f2c1f4689629 (diff) |
adding a 2nd parameters to detailsCircle()
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | lib/Api/v1/Circles.php | 5 | ||||
-rw-r--r-- | lib/Db/CirclesRequest.php | 6 | ||||
-rw-r--r-- | lib/Service/CirclesService.php | 9 |
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/Api/v1/Circles.php b/lib/Api/v1/Circles.php index e5df11ed..1d59ff35 100644 --- a/lib/Api/v1/Circles.php +++ b/lib/Api/v1/Circles.php @@ -239,15 +239,16 @@ class Circles { * return as well. * * @param string $circleUniqueId + * @param bool $forceAll * * @return Circle * @throws QueryException */ - public static function detailsCircle($circleUniqueId) { + public static function detailsCircle($circleUniqueId, $forceAll = false) { $c = self::getContainer(); return $c->query(CirclesService::class) - ->detailsCircle($circleUniqueId); + ->detailsCircle($circleUniqueId, $forceAll); } diff --git a/lib/Db/CirclesRequest.php b/lib/Db/CirclesRequest.php index aef18f98..aec55578 100644 --- a/lib/Db/CirclesRequest.php +++ b/lib/Db/CirclesRequest.php @@ -170,11 +170,13 @@ class CirclesRequest extends CirclesRequestBuilder { * * @param string $circleUniqueId * @param string $viewerId + * @param bool $forceAll * * @return Circle * @throws CircleDoesNotExistException + * @throws ConfigNoCircleAvailableException */ - public function getCircle($circleUniqueId, $viewerId) { + public function getCircle($circleUniqueId, $viewerId, $forceAll = false) { $qb = $this->getCirclesSelectSql(); $this->limitToShortenUniqueId($qb, $circleUniqueId, Circle::SHORT_UNIQUE_ID_LENGTH); @@ -183,7 +185,7 @@ class CirclesRequest extends CirclesRequestBuilder { $this->leftJoinOwner($qb); $this->leftJoinNCGroupAndUser($qb, $viewerId, '`c`.`unique_id`'); - $this->limitRegardingCircleType($qb, $viewerId, $circleUniqueId, Circle::CIRCLES_ALL, ''); + $this->limitRegardingCircleType($qb, $viewerId, $circleUniqueId, Circle::CIRCLES_ALL, '', $forceAll); $cursor = $qb->execute(); $data = $cursor->fetch(); diff --git a/lib/Service/CirclesService.php b/lib/Service/CirclesService.php index b87a63b5..d7693aa9 100644 --- a/lib/Service/CirclesService.php +++ b/lib/Service/CirclesService.php @@ -210,14 +210,15 @@ class CirclesService { * returns details on circle and its members if this->userId is a member itself. * * @param string $circleUniqueId + * @param bool $forceAll * * @return Circle - * @throws \Exception + * @throws Exception */ - public function detailsCircle($circleUniqueId) { + public function detailsCircle($circleUniqueId, $forceAll = false) { try { - $circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId); + $circle = $this->circlesRequest->getCircle($circleUniqueId, $this->userId, $forceAll); if ($this->viewerIsAdmin() || $circle->getHigherViewer() ->isLevel(Member::LEVEL_MEMBER) @@ -570,7 +571,7 @@ class CirclesService { $limit = $this->configService->getAppValue(ConfigService::CIRCLES_MEMBERS_LIMIT); } - if (sizeof($members) >= $limit) { + if (sizeof($members) >= $limit) { throw new MembersLimitException( 'This circle already reach its limit on the number of members' ); |