-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(teams): resolve undefined variable error and add logging #6290
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main nextcloud/calendar#6290 +/- ##
============================================
- Coverage 23.88% 23.87% -0.01%
+ Complexity 454 453 -1
============================================
Files 246 246
Lines 11656 11660 +4
Branches 2201 2200 -1
============================================
Hits 2784 2784
- Misses 8556 8560 +4
Partials 316 316
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/backport to stable5.0 |
/backport to stable4.7 |
* | ||
* @NoAdminRequired | ||
*/ | ||
public function getCircleMembers(string $circleId):JSONResponse { | ||
if (!$this->appManager->isEnabledForUser('circles') || !class_exists('\OCA\Circles\Api\v1\Circles')) { | ||
if (!class_exists('\OCA\Circles\Api\v1\Circles') || !$this->appManager->isEnabledForUser('circles')) { | ||
$this->logger->debug('Circles not enabled'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the debug log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is only called, from the frontend, when circles is enabled.
* | ||
* @NoAdminRequired | ||
*/ | ||
public function getCircleMembers(string $circleId):JSONResponse { | ||
if (!$this->appManager->isEnabledForUser('circles') || !class_exists('\OCA\Circles\Api\v1\Circles')) { | ||
if (!class_exists('\OCA\Circles\Api\v1\Circles') || !$this->appManager->isEnabledForUser('circles')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question, why are we checking if the class exists? Would the check for isEnabledForUser not be sufficient enough to determine if the circles app is installed, enabled on the system and permitted for this user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original pr mentions a problem with Psalm #5420 (review) ;)
I haven't done any profiling but would expect, especially now with the flipped condition, a little performance gain for systems without circles.
isEnabledForUser does a lot (fetch the installed app versions for all apps, see if the app is installed, fetch the user session, fetch the groups for a user, see if the user has a group that the app is enabled for).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isEnabledForUser does a lot (fetch the installed app versions for all apps, see if the app is installed, fetch the user session, fetch the groups for a user, see if the user has a group that the app is enabled for).
I checked the code... Thats not the case, I think the original author just didn't know there was a build in function to see if the app was enabled, and checked for the existence for the class instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats not the case
What is not the case?
Signed-off-by: Anna Larch anna@nextcloud.com