mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 05:34:16 -04:00
Use direct return instead of Ok()
This commit is contained in:
parent
08401f923d
commit
68ea589f1a
@ -1,9 +1,7 @@
|
|||||||
#nullable enable
|
using System;
|
||||||
#pragma warning disable CA1801
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
@ -76,6 +74,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "isGuest", Justification = "Imported from ServiceStack")]
|
||||||
public ActionResult<IEnumerable<UserDto>> GetUsers(
|
public ActionResult<IEnumerable<UserDto>> GetUsers(
|
||||||
[FromQuery] bool? isHidden,
|
[FromQuery] bool? isHidden,
|
||||||
[FromQuery] bool? isDisabled,
|
[FromQuery] bool? isDisabled,
|
||||||
@ -97,7 +96,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
// If the startup wizard hasn't been completed then just return all users
|
// If the startup wizard hasn't been completed then just return all users
|
||||||
if (!_config.Configuration.IsStartupWizardCompleted)
|
if (!_config.Configuration.IsStartupWizardCompleted)
|
||||||
{
|
{
|
||||||
return Ok(GetUsers(false, false, false).Value);
|
return Ok(Get(false, false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(Get(false, false, true, true));
|
return Ok(Get(false, false, true, true));
|
||||||
@ -124,7 +123,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var result = _userManager.GetUserDto(user, HttpContext.Connection.RemoteIpAddress.ToString());
|
var result = _userManager.GetUserDto(user, HttpContext.Connection.RemoteIpAddress.ToString());
|
||||||
return Ok(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -219,7 +218,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
Username = request.Username
|
Username = request.Username
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
|
|
||||||
return Ok(result);
|
return result;
|
||||||
}
|
}
|
||||||
catch (SecurityException e)
|
catch (SecurityException e)
|
||||||
{
|
{
|
||||||
@ -476,7 +475,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
|
|
||||||
var result = _userManager.GetUserDto(newUser, HttpContext.Connection.RemoteIpAddress.ToString());
|
var result = _userManager.GetUserDto(newUser, HttpContext.Connection.RemoteIpAddress.ToString());
|
||||||
|
|
||||||
return Ok(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -494,7 +493,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
|
|
||||||
var result = await _userManager.StartForgotPasswordProcess(enteredUsername, isLocal).ConfigureAwait(false);
|
var result = await _userManager.StartForgotPasswordProcess(enteredUsername, isLocal).ConfigureAwait(false);
|
||||||
|
|
||||||
return Ok(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -508,7 +507,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
public async Task<ActionResult<PinRedeemResult>> ForgotPasswordPin([FromBody] string pin)
|
public async Task<ActionResult<PinRedeemResult>> ForgotPasswordPin([FromBody] string pin)
|
||||||
{
|
{
|
||||||
var result = await _userManager.RedeemPasswordResetPin(pin).ConfigureAwait(false);
|
var result = await _userManager.RedeemPasswordResetPin(pin).ConfigureAwait(false);
|
||||||
return Ok(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<UserDto> Get(bool? isHidden, bool? isDisabled, bool filterByDevice, bool filterByNetwork)
|
private IEnumerable<UserDto> Get(bool? isHidden, bool? isDisabled, bool filterByDevice, bool filterByNetwork)
|
||||||
@ -545,8 +544,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
|
|
||||||
var result = users
|
var result = users
|
||||||
.OrderBy(u => u.Username)
|
.OrderBy(u => u.Username)
|
||||||
.Select(i => _userManager.GetUserDto(i, HttpContext.Connection.RemoteIpAddress.ToString()))
|
.Select(i => _userManager.GetUserDto(i, HttpContext.Connection.RemoteIpAddress.ToString()));
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user