Use dependency injection for config classes
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user