mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-16 20:56:03 +00:00
Harden push notification delivery
Keep encrypted message content out of push payloads and improve cross-platform notification data. Add token registration validation and per-session unregister support, batch and deduplicate sends, remove only confirmed unregistered tokens, and protect queued retries with leases. Add delivery tests and document the push API and Firebase setup.
This commit is contained in:
@@ -13,20 +13,34 @@ namespace Govor.API.Controllers;
|
||||
[ApiController]
|
||||
[Authorize(Roles = "Admin,User")]
|
||||
[Route("api/groups/{groupId:guid}/reactions")]
|
||||
public class ChannelReactionsController(IMessageReactionService reactions, ICurrentUserService currentUser,
|
||||
IMapper mapper, IChatNotificationService notifier) : ControllerBase
|
||||
public class ChannelReactionsController(
|
||||
IMessageReactionService reactions,
|
||||
ICurrentUserService currentUser,
|
||||
IMapper mapper,
|
||||
IChatNotificationService notifier) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(Guid groupId) => (await reactions.GetPolicyAsync(currentUser.GetCurrentUserId(), groupId))
|
||||
.Map(p => mapper.Map<ChannelReactionPolicyResponse>(p)).ToActionResult();
|
||||
public async Task<IActionResult> Get(Guid groupId) =>
|
||||
(await reactions.GetPolicyAsync(currentUser.GetCurrentUserId(), groupId))
|
||||
.Map(p => mapper.Map<ChannelReactionPolicyResponse>(p))
|
||||
.ToActionResult();
|
||||
|
||||
[HttpPut]
|
||||
public async Task<IActionResult> Set(Guid groupId, [FromBody] ChannelReactionPolicyRequest request)
|
||||
{
|
||||
var result = await reactions.SetPolicyAsync(currentUser.GetCurrentUserId(), groupId, request.Mode, request.ReactionIds);
|
||||
if (result.IsFailure) return result.ToActionResult();
|
||||
var result = await reactions.SetPolicyAsync(
|
||||
currentUser.GetCurrentUserId(),
|
||||
groupId,
|
||||
request.Mode,
|
||||
request.ReactionIds);
|
||||
|
||||
if (result.IsFailure)
|
||||
return result.ToActionResult();
|
||||
|
||||
var response = mapper.Map<ChannelReactionPolicyResponse>(result.Value);
|
||||
|
||||
await notifier.NotifyChannelReactionPolicyChangedAsync(response);
|
||||
|
||||
return Ok(response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user