Use dependency injection for config classes

This commit is contained in:
Benjamin Carleski
2020-01-21 17:03:46 -08:00
parent 1bf1a86f94
commit fd3ef48367
42 changed files with 230 additions and 126 deletions

View File

@@ -21,6 +21,7 @@ using Umbraco.Core.Strings;
using Umbraco.Web.Security;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core.Mapping;
using Umbraco.Core.Configuration.UmbracoSettings;
namespace Umbraco.Web.Editors
{
@@ -31,6 +32,7 @@ namespace Umbraco.Web.Editors
public class CurrentUserController : UmbracoAuthorizedJsonController
{
private readonly IMediaFileSystem _mediaFileSystem;
private readonly IUmbracoSettingsSection _umbracoSettingsSection;
public CurrentUserController(
IGlobalSettings globalSettings,
@@ -43,10 +45,12 @@ namespace Umbraco.Web.Editors
UmbracoHelper umbracoHelper,
IMediaFileSystem mediaFileSystem,
IShortStringHelper shortStringHelper,
UmbracoMapper umbracoMapper)
UmbracoMapper umbracoMapper,
IUmbracoSettingsSection umbracoSettingsSection)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper, umbracoMapper)
{
_mediaFileSystem = mediaFileSystem;
_umbracoSettingsSection = umbracoSettingsSection ?? throw new ArgumentNullException(nameof(umbracoSettingsSection));
}
/// <summary>
@@ -180,7 +184,7 @@ namespace Umbraco.Web.Editors
public async Task<HttpResponseMessage> PostSetAvatar()
{
//borrow the logic from the user controller
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, ShortStringHelper, Security.GetUserId().ResultOr(0));
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, ShortStringHelper, _umbracoSettingsSection, Security.GetUserId().ResultOr(0));
}
/// <summary>