1
0
mirror of https://github.com/bitwarden/server synced 2026-01-05 01:53:17 +00:00

[PM-17563] Add missing TaskId and HubHelper for PendingSecurityTasks (#5591)

* [PM-17563] Add case for PushType.PendingSecurityTasks

* [PM-17563] Add missing TaskId property to NotificationStatusDetails and NotificationResponseModel

* [PM-17563] Add migration script to re-create NotificationStatusDetailsView to include TaskId column

* [PM-17563] Select explicit columns for NotificationStatusDetailsView and fix migration script
This commit is contained in:
Shane Melton
2025-04-02 13:44:59 -07:00
committed by GitHub
parent 7b2b62e794
commit d4a3cd00be
8 changed files with 54 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ public class NotificationResponseModel : ResponseModel
Title = notificationStatusDetails.Title;
Body = notificationStatusDetails.Body;
Date = notificationStatusDetails.RevisionDate;
TaskId = notificationStatusDetails.TaskId;
ReadDate = notificationStatusDetails.ReadDate;
DeletedDate = notificationStatusDetails.DeletedDate;
}
@@ -40,6 +41,8 @@ public class NotificationResponseModel : ResponseModel
public DateTime Date { get; set; }
public Guid? TaskId { get; set; }
public DateTime? ReadDate { get; set; }
public DateTime? DeletedDate { get; set; }

View File

@@ -19,6 +19,7 @@ public class NotificationStatusDetails
public string? Body { get; set; }
public DateTime CreationDate { get; set; }
public DateTime RevisionDate { get; set; }
public Guid? TaskId { get; set; }
// Notification Status fields
public DateTime? ReadDate { get; set; }
public DateTime? DeletedDate { get; set; }

View File

@@ -52,6 +52,7 @@ public class NotificationStatusDetailsViewQuery(Guid userId, ClientType clientTy
ClientType = x.n.ClientType,
UserId = x.n.UserId,
OrganizationId = x.n.OrganizationId,
TaskId = x.n.TaskId,
Title = x.n.Title,
Body = x.n.Body,
CreationDate = x.n.CreationDate,

View File

@@ -135,6 +135,11 @@ public static class HubHelpers
}
break;
case PushType.PendingSecurityTasks:
var pendingTasksData = JsonSerializer.Deserialize<PushNotificationData<UserPushNotification>>(notificationJson, _deserializerOptions);
await hubContext.Clients.User(pendingTasksData.Payload.UserId.ToString())
.SendAsync(_receiveMessageMethod, pendingTasksData, cancellationToken);
break;
default:
break;
}

View File

@@ -1,10 +1,20 @@
CREATE VIEW [dbo].[NotificationStatusDetailsView]
AS
SELECT
N.*,
NS.UserId AS NotificationStatusUserId,
NS.ReadDate,
NS.DeletedDate
N.[Id],
N.[Priority],
N.[Global],
N.[ClientType],
N.[UserId],
N.[OrganizationId],
N.[Title],
N.[Body],
N.[CreationDate],
N.[RevisionDate],
N.[TaskId],
NS.[UserId] AS [NotificationStatusUserId],
NS.[ReadDate],
NS.[DeletedDate]
FROM
[dbo].[Notification] AS N
LEFT JOIN