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

OSOE-532: Fixing analyzer violations #47

Merged
merged 3 commits into from
Jan 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultE
if (actionRouteController == typeof(AdminController).ControllerName() &&
actionRouteArea == $"{nameof(OrchardCore)}.{nameof(OrchardCore.Tenants)}" &&
actionRouteValue is nameof(AdminController.Edit) &&
context.Result is ViewResult viewResult &&
context.Result is ViewResult &&
await _authorizationService.AuthorizeAsync(
_hca.HttpContext.User,
TenantAdminPermissions.LoginAsAdmin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,14 @@ public async Task EnableConditionallyEnabledFeaturesAsync(IFeatureInfo featureIn
.Select(keyValuePair => keyValuePair.Key)
.ToList();

// Handle multiple conditional features as well.
var conditionalFeatures = allFeatures.Where(feature => conditionalFeatureIds.Contains(feature.Id));

// During setup, Shell Descriptor can become out of sync with the DB when it comes to enabled features,
// but it's more accurate than IShellDescriptorManager's methods.
var shellDescriptor = await _shellDescriptorManager.GetShellDescriptorAsync();

// If Shell Descriptor's Features already contains a feature that is found in conditionalFeatures, remove it
// from the list.
var featuresToEnable = conditionalFeatures.ToList();
foreach (var feature in conditionalFeatures.Where(feature => shellDescriptor.Features.Contains(new ShellFeature(feature.Id))))
{
featuresToEnable.Remove(feature);
}
// from the list. Handle multiple conditional features as well.
var featuresToEnable = allFeatures.Where(feature =>
conditionalFeatureIds.Contains(feature.Id) && !shellDescriptor.Features.Contains(new ShellFeature(feature.Id)));

await _shellFeaturesManager.EnableFeaturesAsync(featuresToEnable, force: true);
}
Expand Down