Skip to content

Commit 7d4c435

Browse files
author
Daniel Jacinto
authored
Add feature flags for TFM. (#8929)
1 parent d01ec31 commit 7d4c435

6 files changed

Lines changed: 39 additions & 10 deletions

File tree

src/AccountDeleter/EmptyFeatureFlagService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public bool IsAsyncAccountDeleteEnabled()
5151
throw new NotImplementedException();
5252
}
5353

54+
public bool IsComputeTargetFrameworkEnabled()
55+
{
56+
throw new NotImplementedException();
57+
}
58+
5459
public bool IsDeletePackageApiEnabled(User user)
5560
{
5661
throw new NotImplementedException();
@@ -81,7 +86,7 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)
8186
throw new NotImplementedException();
8287
}
8388

84-
public bool IsDisplayTargetFrameworkEnabled()
89+
public bool IsDisplayTargetFrameworkEnabled(User user)
8590
{
8691
throw new NotImplementedException();
8792
}

src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,12 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)
270270
throw new NotImplementedException();
271271
}
272272

273-
public bool IsDisplayTargetFrameworkEnabled()
273+
public bool IsDisplayTargetFrameworkEnabled(User user)
274+
{
275+
throw new NotImplementedException();
276+
}
277+
278+
public bool IsComputeTargetFrameworkEnabled()
274279
{
275280
throw new NotImplementedException();
276281
}

src/NuGetGallery.Services/Configuration/FeatureFlagService.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class FeatureFlagService : IFeatureFlagService
5353
private const string DisplayPackagePageV2FeatureName = GalleryPrefix + "DisplayPackagePageV2";
5454
private const string ShowReportAbuseSafetyChanges = GalleryPrefix + "ShowReportAbuseSafetyChanges";
5555
private const string DisplayTargetFrameworkFeatureName = GalleryPrefix + "DisplayTargetFramework";
56+
private const string ComputeTargetFrameworkFeatureName = GalleryPrefix + "ComputeTargetFramework";
5657

5758
private const string ODataV1GetAllNonHijackedFeatureName = GalleryPrefix + "ODataV1GetAllNonHijacked";
5859
private const string ODataV1GetAllCountNonHijackedFeatureName = GalleryPrefix + "ODataV1GetAllCountNonHijacked";
@@ -253,11 +254,11 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)
253254
return _client.IsEnabled(DisplayPackagePageV2PreviewFeatureName, user, defaultValue: false);
254255
}
255256

256-
public bool IsDisplayPackagePageV2Enabled(User user)
257+
public bool IsDisplayPackagePageV2Enabled(User user)
257258
{
258259
return _client.IsEnabled(DisplayPackagePageV2FeatureName, user, defaultValue: false);
259260
}
260-
261+
261262
public bool IsODataV1GetAllEnabled()
262263
{
263264
return _client.IsEnabled(ODataV1GetAllNonHijackedFeatureName, defaultValue: true);
@@ -342,7 +343,7 @@ public bool IsMarkdigMdRenderingEnabled()
342343
{
343344
return _client.IsEnabled(MarkdigMdRenderingFlightName, defaultValue: false);
344345
}
345-
346+
346347
public bool IsDeletePackageApiEnabled(User user)
347348
{
348349
return _client.IsEnabled(DeletePackageApiFlightName, user, defaultValue: false);
@@ -358,9 +359,14 @@ public bool IsDisplayBannerEnabled()
358359
return _client.IsEnabled(DisplayBannerFlightName, defaultValue: false);
359360
}
360361

361-
public bool IsDisplayTargetFrameworkEnabled()
362+
public bool IsDisplayTargetFrameworkEnabled(User user)
363+
{
364+
return _client.IsEnabled(DisplayTargetFrameworkFeatureName, user, defaultValue: false);
365+
}
366+
367+
public bool IsComputeTargetFrameworkEnabled()
362368
{
363-
return _client.IsEnabled(DisplayTargetFrameworkFeatureName, defaultValue: false);
369+
return _client.IsEnabled(ComputeTargetFrameworkFeatureName, defaultValue: false);
364370
}
365371
}
366372
}

src/NuGetGallery.Services/Configuration/IFeatureFlagService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ public interface IFeatureFlagService
290290
/// <summary>
291291
/// Whether or not display target framework badges and table on nuget.org
292292
/// </summary>
293-
bool IsDisplayTargetFrameworkEnabled();
293+
bool IsDisplayTargetFrameworkEnabled(User user);
294+
295+
/// <summary>
296+
/// Whether or not to compute backend operations for target framework. This flag is overridden by <see cref="IsDisplayTargetFrameworkEnabled"/> if that flag is true.
297+
/// </summary>
298+
bool IsComputeTargetFrameworkEnabled();
294299
}
295300
}

src/NuGetGallery/App_Data/Files/Content/flags.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"NuGetGallery.MarkdigMdRendering": "Enabled",
3232
"NuGetGallery.ImageAllowlist": "Enabled",
3333
"NuGetGallery.ShowReportAbuseSafetyChanges": "Enabled",
34-
"NuGetGallery.DisplayTFM": "Enabled"
34+
"NuGetGallery.ComputeTargetFramework": "Enabled"
3535
},
3636
"Flights": {
3737
"NuGetGallery.TyposquattingFlight": {
@@ -111,6 +111,12 @@
111111
"SiteAdmins": false,
112112
"Accounts": [],
113113
"Domains": []
114+
},
115+
"NuGetGallery.DisplayTargetFramework": {
116+
"All": true,
117+
"SiteAdmins": false,
118+
"Accounts": [],
119+
"Domains": []
114120
}
115121
}
116122
}

src/VerifyMicrosoftPackage/Fakes/FakeFeatureFlagService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)
120120
throw new NotImplementedException();
121121
}
122122

123-
public bool IsDisplayTargetFrameworkEnabled() => throw new NotImplementedException();
123+
public bool IsDisplayTargetFrameworkEnabled(User user) => throw new NotImplementedException();
124+
125+
public bool IsComputeTargetFrameworkEnabled() => throw new NotImplementedException();
124126
}
125127
}

0 commit comments

Comments
 (0)