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

Clarify app manager method names #49648

Merged
merged 5 commits into from
Feb 13, 2025
Merged

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Dec 4, 2024

  • Resolves: #

Summary

Renames isInstalled -> isEnabledForAnyone, and getInstalledApps -> getEnabledApps.

There is a weird situation for apps which are enabled only for some groups of users:

  • They are in the return of getInstalledApps/getEnabledApps
  • They return true for isInstalled/isEnabledForAnyone (which is why I named it that way)
    For isEnabled*, one can use isEnabledForUser($app, null), to check if the app is enabled for everyone.
    But for getEnabled*, there is no equivalent, as getEnabledForUser parameter is mandatory.
    Because of that, in NavigationManager, isEnabledForUser is called on each app returned by getInstalledApps.

We could consider that when there is no user in session we should always exclude apps enabled only for some groups, and I think for public pages it makes sense (does it?).
But the issue is for occ cli tool, there there is no user in session but we do want to consider app enabled for some groups only as enabled.

So basically for each getInstalledApps call, we should ask ourselves whether the list should include partially-enabled apps or not, and replace with the appropriate method call.
We may want to rename getEnabledApps with a more precise name, but getEnableAppsForAnyone is ugly, no?
We may want to add a way to get apps enabled for everyone, either as a new method or by making the parameter nullable in getEnabledAppsForUser.

Checklist

@come-nc come-nc added the 2. developing Work in progress label Dec 4, 2024
@come-nc come-nc self-assigned this Dec 4, 2024
@come-nc come-nc requested a review from tcitworld December 4, 2024 15:14
@come-nc come-nc requested a review from nickvergessen January 21, 2025 09:15
@come-nc
Copy link
Contributor Author

come-nc commented Jan 21, 2025

@nickvergessen Thoughts on the naming and logic?

lib/public/App/IAppManager.php Outdated Show resolved Hide resolved
@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Jan 30, 2025
@come-nc come-nc force-pushed the fix/clarify-app-manager-methods branch 3 times, most recently from c75772e to 6e4b6d7 Compare February 10, 2025 10:42
@come-nc come-nc marked this pull request as ready for review February 10, 2025 11:30
@come-nc come-nc added enhancement 3. to review Waiting for reviews technical debt and removed 2. developing Work in progress labels Feb 10, 2025
Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

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

LGTM, just some of the commits should be squashed

The method name was really confusing

Signed-off-by: Côme Chilliet <[email protected]>
Remove all references to installed apps where it’s about enabled apps

Signed-off-by: Côme Chilliet <[email protected]>
@come-nc come-nc force-pushed the fix/clarify-app-manager-methods branch from 8934d58 to f758f56 Compare February 13, 2025 09:20
@come-nc
Copy link
Contributor Author

come-nc commented Feb 13, 2025

rebased and squashed some commits

@come-nc come-nc merged commit ed9b474 into master Feb 13, 2025
189 checks passed
@come-nc come-nc deleted the fix/clarify-app-manager-methods branch February 13, 2025 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants