mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-16 20:56:03 +00:00
Add reactions, reliable push & session checks
Implements message reactions and reaction packs (domain models, services, admin HTTP API, media processing via ImageSharp and limits) and adds reliable push delivery (ChatPushNotification, ChatPushDispatcher, ChatPushWorker, improved ChatNotificationService). Enhances message reading (ReadChat API, unread counts, concurrency-safe receipts) and tightens session security (access-token session validation in JWT, hub filter, SessionAuthorization). Improves SignalR behavior (session groups, reaction/channel events, hub/error mappings). Adds EF migrations, many controller fixes (Forbid handling, password API), tests (Govor.Server.Tests), docs, CI and tooling updates (Dockerfile → .NET 10, GH Actions matrix for sqlite/postgres, Govor.Server.slnx, global.json), and small infra changes (AutoMapper bump, NullPushProvider, storage/token handling).
This commit is contained in:
@@ -3,13 +3,14 @@ using Govor.Contracts.Responses.Admins;
|
||||
using Govor.Domain.Models.Users;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Govor.Contracts.Requests;
|
||||
|
||||
namespace Govor.API.Controllers.AdminStuff;
|
||||
|
||||
|
||||
[ApiController]
|
||||
[Route("api/admin/[controller]")]
|
||||
[Authorize]//(Roles = "Admin")
|
||||
[Authorize(Roles = "Admin")]
|
||||
public class UsersController : Controller
|
||||
{
|
||||
private readonly ILogger<UsersController> _logger;
|
||||
@@ -48,6 +49,8 @@ public class UsersController : Controller
|
||||
{
|
||||
_logger.LogInformation($"Getting user {id} by administrator");
|
||||
var read = await _users.GetUserById(id);
|
||||
if (read is null)
|
||||
return NotFound();
|
||||
return Ok(BuildUserDtos([read]).First());
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -57,13 +60,15 @@ public class UsersController : Controller
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("user/{id:guid}/setpassword/{password}")]
|
||||
public async Task<IActionResult> SetNewPassword(Guid id, string password)
|
||||
[HttpPost("user/{id:guid}/password")]
|
||||
public async Task<IActionResult> SetNewPassword(Guid id, [FromBody] SetPasswordRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _users.SetPasswordAsync(id, password);
|
||||
return Ok();
|
||||
if (await _users.GetUserById(id) is null)
|
||||
return NotFound();
|
||||
await _users.SetPasswordAsync(id, request.Password);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -78,10 +83,9 @@ public class UsersController : Controller
|
||||
Description = user.Description,
|
||||
WasOnline = user.WasOnline,
|
||||
IconId = user.IconId,
|
||||
PasswordHash = user.PasswordHash,
|
||||
InviteId = user.InviteId,
|
||||
CreatedOn = user.CreatedOn,
|
||||
IsAdmin = user.Invite?.IsAdmin ?? false,
|
||||
}).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user