Expire cache for AI feature availability
It's expensive to check if a user has any group with the AI features enabled and we check this on every page load for the chat. That's why we cache User#any_group_with_ai_available?
.
However, this causes now confusion as a customer would enable the Experimental features and chat, but since we don't expire the cache, they do not see the AI features immediately. Only after 1h.
The cache is per user, but the expiration happens per group. So we'd need to expire the cache for all members of a group when:
- the setting changes
- a group updates to ultimate
- a member gets added to the group
- members gets removed from a group
- in the future: a group buys the AI addon
Edited by Nicolas Dular