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: Disable segment override diffs for non versioned environments #3914

Merged
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
3 changes: 3 additions & 0 deletions frontend/web/components/diff/DiffChangeRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ type DiffChangeRequestType = {
changeRequest: ChangeRequest | null
feature: number
projectId: string
isVersioned: boolean
}

const DiffChangeRequest: FC<DiffChangeRequestType> = ({
changeRequest,
feature,
isVersioned,
projectId,
}) => {
const { data, isLoading } = useGetFeatureStatesQuery(
Expand All @@ -36,6 +38,7 @@ const DiffChangeRequest: FC<DiffChangeRequestType> = ({
<div className='col-md-8'>
<DiffFeature
featureId={feature}
disableSegments={!isVersioned}
projectId={projectId}
newState={changeRequest.feature_states}
oldState={data?.results || []}
Expand Down
6 changes: 5 additions & 1 deletion frontend/web/components/diff/DiffFeature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ type FeatureDiffType = {
featureId: number
projectId: string
tabTheme?: string
disableSegments?: boolean
}

const DiffFeature: FC<FeatureDiffType> = ({
disableSegments,
featureId,
newState,
noChangesMessage,
Expand All @@ -47,7 +49,9 @@ const DiffFeature: FC<FeatureDiffType> = ({
projectId,
})

const segmentDiffs = getSegmentDiff(oldState, newState, segments?.results)
const segmentDiffs = disableSegments
? { diffs: [], totalChanges: 0 }
: getSegmentDiff(oldState, newState, segments?.results)
const variationDiffs = getVariationDiff(oldEnv, newEnv, feature)
const totalSegmentChanges = segmentDiffs?.totalChanges
const totalVariationChanges = variationDiffs?.totalChanges
Expand Down
1 change: 1 addition & 0 deletions frontend/web/components/pages/ChangeRequestPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ const ChangeRequestsPage = class extends Component {
</div>
</Panel>
<DiffChangeRequest
isVersioned={isVersioned}
changeRequest={changeRequest}
feature={projectFlag.id}
projectId={this.props.match.params.projectId}
Expand Down