added methods to update vanity colors and submodule bump
This commit is contained in:
@@ -6,6 +6,7 @@ using LightlessSync.API.Data;
|
||||
using LightlessSync.API.Dto.Group;
|
||||
using LightlessSyncShared.Metrics;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System.Threading;
|
||||
|
||||
namespace LightlessSyncServer.Hubs;
|
||||
|
||||
@@ -97,6 +98,28 @@ public partial class LightlessHub
|
||||
await _redis.RemoveAsync("UID:" + UserUID, StackExchange.Redis.CommandFlags.FireAndForget).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<User?> EnsureUserHasVanity(string uid, CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken = cancellationToken == default && _contextAccessor.HttpContext != null
|
||||
? _contextAccessor.HttpContext.RequestAborted
|
||||
: cancellationToken;
|
||||
|
||||
var user = await DbContext.Users.SingleOrDefaultAsync(u => u.UID == uid, cancellationToken).ConfigureAwait(false);
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogCallWarning(LightlessHubLogger.Args("vanity check", uid, "missing user"));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (user.HasVanity != true)
|
||||
{
|
||||
_logger.LogCallWarning(LightlessHubLogger.Args("vanity check", uid, "no vanity"));
|
||||
return null;
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
private async Task SendGroupDeletedToAll(List<GroupPair> groupUsers)
|
||||
{
|
||||
foreach (var pair in groupUsers)
|
||||
|
||||
Reference in New Issue
Block a user