mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
chore: remove detectSegmentUsageInChangeRequests flag (#6080)
What it says on the tin. Removes all uses of the detectSegmentUsageInChangeRequests flag.
This commit is contained in:
parent
d7eb950f3a
commit
73322f12f7
@ -82,7 +82,6 @@ exports[`should create default config 1`] = `
|
||||
"createdByUserIdDataMigration": false,
|
||||
"customRootRolesKillSwitch": false,
|
||||
"demo": false,
|
||||
"detectSegmentUsageInChangeRequests": false,
|
||||
"disableBulkToggle": false,
|
||||
"disableMetrics": false,
|
||||
"disableNotifications": false,
|
||||
|
@ -11,9 +11,7 @@ let segmentStore: ISegmentStore;
|
||||
beforeAll(async () => {
|
||||
db = await dbInit('segment_store_serial', getLogger, {
|
||||
experimental: {
|
||||
flags: {
|
||||
detectSegmentUsageInChangeRequests: true,
|
||||
},
|
||||
flags: {},
|
||||
},
|
||||
});
|
||||
stores = db.stores;
|
||||
|
@ -115,10 +115,7 @@ export default class SegmentStore implements ISegmentStore {
|
||||
async getAll(
|
||||
includeChangeRequestUsageData: boolean = false,
|
||||
): Promise<ISegment[]> {
|
||||
if (
|
||||
includeChangeRequestUsageData &&
|
||||
this.flagResolver.isEnabled('detectSegmentUsageInChangeRequests')
|
||||
) {
|
||||
if (includeChangeRequestUsageData) {
|
||||
const pendingCRs = await this.db
|
||||
.select('id', 'project')
|
||||
.from('change_requests')
|
||||
|
@ -362,24 +362,21 @@ export class SegmentsController extends Controller {
|
||||
environment: strategy.environment,
|
||||
}));
|
||||
|
||||
if (this.flagResolver.isEnabled('detectSegmentUsageInChangeRequests')) {
|
||||
const changeRequestStrategies =
|
||||
strategies.changeRequestStrategies.map((strategy) => ({
|
||||
...('id' in strategy ? { id: strategy.id } : {}),
|
||||
projectId: strategy.projectId,
|
||||
featureName: strategy.featureName,
|
||||
strategyName: strategy.strategyName,
|
||||
environment: strategy.environment,
|
||||
changeRequest: strategy.changeRequest,
|
||||
}));
|
||||
const changeRequestStrategies = strategies.changeRequestStrategies.map(
|
||||
(strategy) => ({
|
||||
...('id' in strategy ? { id: strategy.id } : {}),
|
||||
projectId: strategy.projectId,
|
||||
featureName: strategy.featureName,
|
||||
strategyName: strategy.strategyName,
|
||||
environment: strategy.environment,
|
||||
changeRequest: strategy.changeRequest,
|
||||
}),
|
||||
);
|
||||
|
||||
res.json({
|
||||
strategies: segmentStrategies,
|
||||
changeRequestStrategies,
|
||||
});
|
||||
} else {
|
||||
res.json({ strategies: segmentStrategies });
|
||||
}
|
||||
res.json({
|
||||
strategies: segmentStrategies,
|
||||
changeRequestStrategies,
|
||||
});
|
||||
}
|
||||
|
||||
async removeSegment(
|
||||
@ -389,12 +386,7 @@ export class SegmentsController extends Controller {
|
||||
const id = Number(req.params.id);
|
||||
|
||||
let segmentIsInUse = false;
|
||||
if (this.flagResolver.isEnabled('detectSegmentUsageInChangeRequests')) {
|
||||
segmentIsInUse = await this.segmentService.isInUse(id);
|
||||
} else {
|
||||
const strategies = await this.segmentService.getAllStrategies(id);
|
||||
segmentIsInUse = strategies.strategies.length > 0;
|
||||
}
|
||||
segmentIsInUse = await this.segmentService.isInUse(id);
|
||||
|
||||
if (segmentIsInUse) {
|
||||
res.status(409).send();
|
||||
|
@ -115,10 +115,7 @@ export class SegmentService implements ISegmentService {
|
||||
const strategies =
|
||||
await this.featureStrategiesStore.getStrategiesBySegment(id);
|
||||
|
||||
if (
|
||||
this.flagResolver.isEnabled('detectSegmentUsageInChangeRequests') &&
|
||||
this.config.isEnterprise
|
||||
) {
|
||||
if (this.config.isEnterprise) {
|
||||
const changeRequestStrategies =
|
||||
await this.changeRequestSegmentUsageReadModel.getStrategiesUsedInActiveChangeRequests(
|
||||
id,
|
||||
|
@ -28,7 +28,6 @@ export type IFlagKey =
|
||||
| 'customRootRolesKillSwitch'
|
||||
| 'disableMetrics'
|
||||
| 'scheduledConfigurationChanges'
|
||||
| 'detectSegmentUsageInChangeRequests'
|
||||
| 'stripClientHeadersOn304'
|
||||
| 'newStrategyConfiguration'
|
||||
| 'stripHeadersOnAPI'
|
||||
@ -133,11 +132,6 @@ const flags: IFlags = {
|
||||
process.env.UNLEASH_EXPERIMENTAL_SCHEDULED_CONFIGURATION_CHANGES,
|
||||
false,
|
||||
),
|
||||
detectSegmentUsageInChangeRequests: parseEnvVarBoolean(
|
||||
process.env
|
||||
.UNLEASH_EXPERIMENTAL_DETECT_SEGMENT_USAGE_IN_CHANGE_REQUESTS,
|
||||
false,
|
||||
),
|
||||
stripClientHeadersOn304: parseEnvVarBoolean(
|
||||
process.env
|
||||
.UNLEASH_EXPERIMENTAL_DETECT_SEGMENT_USAGE_IN_CHANGE_REQUESTS,
|
||||
|
@ -106,7 +106,6 @@ beforeAll(async () => {
|
||||
experimental: {
|
||||
flags: {
|
||||
anonymiseEventLog: true,
|
||||
detectSegmentUsageInChangeRequests: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -588,9 +587,7 @@ describe('detect strategy usage in change requests', () => {
|
||||
ui: { environment: 'Enterprise' },
|
||||
isEnterprise: true,
|
||||
experimental: {
|
||||
flags: {
|
||||
detectSegmentUsageInChangeRequests: true,
|
||||
},
|
||||
flags: {},
|
||||
},
|
||||
},
|
||||
db.rawDatabase,
|
||||
|
@ -188,9 +188,7 @@ beforeAll(async () => {
|
||||
db.stores,
|
||||
{
|
||||
experimental: {
|
||||
flags: {
|
||||
detectSegmentUsageInChangeRequests: true,
|
||||
},
|
||||
flags: {},
|
||||
},
|
||||
},
|
||||
db.rawDatabase,
|
||||
|
Loading…
Reference in New Issue
Block a user