Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Logic in segment overrides readonly with the manage_segment_overrides permission #2973

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/web/components/SegmentOverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class TheComponent extends Component {
const isLimitReached =
segmentOverrideLimitAlert.percentage &&
segmentOverrideLimitAlert.percentage >= 100
const manageSegmentsEnabled = Utils.getFlagsmithHasFeature(
const manageSegmentOverridesEnabled = Utils.getFlagsmithHasFeature(
'manage_segment_overrides_env_role',
)
return (
Expand Down Expand Up @@ -603,7 +603,7 @@ class TheComponent extends Component {
theme='outline'
disabled={
!!isLimitReached ||
(manageSegmentsEnabled && !manageSegments)
(manageSegmentOverridesEnabled && !manageSegments)
}
>
Create Feature-Specific Segment
Expand Down
8 changes: 4 additions & 4 deletions frontend/web/components/modals/CreateFlag.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ const CreateFlag = class extends Component {
const existingChangeRequest = this.props.changeRequest
const hideIdentityOverridesTab = Utils.getShouldHideIdentityOverridesTab()
const noPermissions = this.props.noPermissions
const manageSegmentsEnabled = Utils.getFlagsmithHasFeature(
const manageSegmentOverridesEnabled = Utils.getFlagsmithHasFeature(
'manage_segment_overrides_env_role',
)
let regexValid = true
Expand Down Expand Up @@ -1141,8 +1141,8 @@ const CreateFlag = class extends Component {
manageSegmentOverrides,
}) => {
const isReadOnly =
manageSegmentsEnabled
? manageSegmentOverrides
manageSegmentOverridesEnabled
? !manageSegmentOverrides
: noPermissions
return (
<SegmentOverrides
Expand Down Expand Up @@ -1261,7 +1261,7 @@ const CreateFlag = class extends Component {
!name ||
invalid ||
!savePermission ||
(manageSegmentsEnabled &&
(manageSegmentOverridesEnabled &&
!manageSegmentsOverrides)
}
>
Expand Down
11 changes: 7 additions & 4 deletions frontend/web/components/modals/CreateSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,16 +509,19 @@ const CreateSegment: FC<CreateSegmentType> = ({
id={environmentId}
>
{({ permission: manageSegmentOverrides }) => {
const manageSegmentsEnabled = Utils.getFlagsmithHasFeature(
'manage_segment_overrides_env_role',
)
const manageSegmentOverridesEnabled =
Utils.getFlagsmithHasFeature(
'manage_segment_overrides_env_role',
)
const isReadOnly = !manageSegmentOverrides
return (
<AssociatedSegmentOverrides
feature={segment.feature}
projectId={projectId}
id={segment.id}
readOnly={manageSegmentsEnabled ? isReadOnly : false}
readOnly={
manageSegmentOverridesEnabled ? isReadOnly : false
}
/>
)
}}
Expand Down