mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
chore: Cleanup feature flags (#6096)
- Add more feature flags for CRM, auto_resolution, and reports - Add a SuperAdmin link in the sidebar if the user is a super-admin - SuperAdmin could view all the features on an account irrespective of whether the feature is enabled.
This commit is contained in:
@@ -21,7 +21,16 @@ export const getters = {
|
||||
getUIFlags($state) {
|
||||
return $state.uiFlags;
|
||||
},
|
||||
isFeatureEnabledonAccount: $state => (id, featureName) => {
|
||||
isFeatureEnabledonAccount: ($state, _, __, rootGetters) => (
|
||||
id,
|
||||
featureName
|
||||
) => {
|
||||
// If a user is SuperAdmin and has access to the account, then they would see all the available features
|
||||
const isUserASuperAdmin = rootGetters.getCurrentUser?.type === 'SuperAdmin';
|
||||
if (isUserASuperAdmin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const { features = {} } =
|
||||
$state.records.find(record => record.id === Number(id)) || {};
|
||||
return features[featureName] || false;
|
||||
|
||||
Reference in New Issue
Block a user