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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

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

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 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?

* List all apps enabled, either for everyone or for specific groups only
*
* @return list<string>
* @since 31.0
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @since 31.0
* @since 31.0.0

@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants