FIX: allowed_theme_ids should not be persisted in GlobalSettings (PR #14756)

It was observed that the memoized value of GlobalSetting.allowed_theme_ids would be persisted across requests, which could lead to unpredictable/undesired behaviours in a multisite environment.

This change moves that logic out of GlobalSettings so that the returned theme IDs are correct for the current site.


I think this class-level memoized value is still going to be shared between different databases in a multisite cluster? Maybe we should use the Theme.cache distributed cache instead? (Uses DistributedCache, which has built-in multisite logic)

Or alternatively we could memoize it per-db. IIRC we do this for the value of Discourse.system_user

Also, I guess we also need to clear this cache whenever themes are installed/uninstalled?