Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

miaulalala
Copy link
Contributor

@miaulalala miaulalala commented Aug 26, 2024

Signed-off-by: Anna Larch [email protected]

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 23.87%. Comparing base (ef73eaf) to head (adef3c9).
Report is 32 commits behind head on main.

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              
Flag Coverage Δ
javascript 15.45% <ø> (ø)
php 59.42% <ø> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@miaulalala miaulalala marked this pull request as ready for review September 5, 2024 19:35
@miaulalala miaulalala self-assigned this Sep 5, 2024
@miaulalala miaulalala added the 3. to review Waiting for reviews label Sep 5, 2024
@miaulalala miaulalala added this to the v5.0.1 milestone Sep 5, 2024
@miaulalala
Copy link
Contributor Author

/backport to stable5.0

@backportbot backportbot bot added the backport-request A backport was requested for this pull request label Sep 5, 2024
@miaulalala
Copy link
Contributor Author

/backport to stable4.7

@miaulalala miaulalala added the bug label Sep 5, 2024
*
* @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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the debug log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not?

Copy link
Contributor

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')) {
Copy link
Contributor

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?

Copy link
Contributor

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).

Copy link
Contributor

@SebastianKrupinski SebastianKrupinski Sep 8, 2024

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.

Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews backport-request A backport was requested for this pull request bug
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

3 participants