Version Update Modal Rework + A few bugfixes (#3664)
This commit is contained in:
parent
9fb3bdd548
commit
43d0d1277f
65 changed files with 1963 additions and 805 deletions
|
@ -11,6 +11,7 @@ using API.Entities.Enums.UserPreferences;
|
|||
using API.Entities.History;
|
||||
using API.Entities.Interfaces;
|
||||
using API.Entities.Metadata;
|
||||
using API.Entities.MetadataMatching;
|
||||
using API.Entities.Scrobble;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
|
|
|
@ -7,6 +7,7 @@ using API.DTOs.Settings;
|
|||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Metadata;
|
||||
using API.Entities.MetadataMatching;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
|
@ -546,7 +546,16 @@ public class UserRepository : IUserRepository
|
|||
public async Task<IList<string>> GetRoles(int userId)
|
||||
{
|
||||
var user = await _context.Users.FirstOrDefaultAsync(u => u.Id == userId);
|
||||
if (user == null || _userManager == null) return ArraySegment<string>.Empty; // userManager is null on Unit Tests only
|
||||
if (user == null) return ArraySegment<string>.Empty;
|
||||
|
||||
if (_userManager == null)
|
||||
{
|
||||
// userManager is null on Unit Tests only
|
||||
return await _context.UserRoles
|
||||
.Where(ur => ur.UserId == userId)
|
||||
.Select(ur => ur.Role.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
return await _userManager.GetRolesAsync(user);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ using API.Data.Repositories;
|
|||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Enums.Theme;
|
||||
using API.Entities.MetadataMatching;
|
||||
using API.Extensions;
|
||||
using API.Services;
|
||||
using Kavita.Common;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue