Fix check for ai availability
What does this MR do and why?
Issue: #415823 (closed)
This add a new method #any_group_with_ai_enabled? to the User model and fixes an issue where we did not check the availability of the chat when the user is only a member of a sub-group.
This fix is not completely correct, as memberships could also happen through other ways (e.g. project memberships). However, there are performance concerns which would take more time to resolve. This MR only fixes it for sub-group memberships as it would at least fix our immediate problem with the community group without additional effort.
While working on this MR, I found that the implementation of User#paid_namespaces
is not correct either. For this I created https://gitlab.com/gitlab-org/gitlab/-/issues/416651 (same concerns around performance apply).
Queries
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.