Skip to content

Commit

Permalink
updating the action check to initialize the super user sagas
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitakinger committed Apr 29, 2024
1 parent 6dfc093 commit a5f7a06
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/client/src/ee/sagas/SuperUserSagas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ import {
RestryRestartServerPoll,
SendTestEmail,
} from "ce/sagas/SuperUserSagas";
import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type { User } from "constants/userConstants";
import { takeLatest, all } from "redux-saga/effects";
import { takeLatest, all, select } from "redux-saga/effects";
import { getCurrentUser } from "selectors/usersSelectors";
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors";
import { isGACEnabled } from "@appsmith/utils/planHelpers";
import { getShowAdminSettings } from "@appsmith/utils/BusinessFeatures/adminSettingsHelpers";

export function* InitSuperUserSaga(action: ReduxAction<User>) {
const user = action.payload;
if (user.isSuperUser) {
export function* InitSuperUserSaga() {
const user: User = yield select(getCurrentUser);
const featureFlags: FeatureFlags = yield select(selectFeatureFlags);
const isFeatureEnabled = isGACEnabled(featureFlags);

if (getShowAdminSettings(isFeatureEnabled, user)) {
yield all([
takeLatest(ReduxActionTypes.FETCH_ADMIN_SETTINGS, FetchAdminSettingsSaga),
takeLatest(
Expand All @@ -34,7 +41,7 @@ export function* InitSuperUserSaga(action: ReduxAction<User>) {

export default function* SuperUserSagas() {
yield takeLatest(
ReduxActionTypes.FETCH_USER_DETAILS_SUCCESS,
ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD,
InitSuperUserSaga,
);
}

0 comments on commit a5f7a06

Please sign in to comment.