feat: add feedback comments activity notifications
This commit is contained in:
@@ -39,11 +39,26 @@ public record FeedbackReportDto(
|
||||
FeedbackContextDto Context,
|
||||
FeedbackScreenshotDto? Screenshot,
|
||||
IReadOnlyCollection<string> Tags,
|
||||
IReadOnlyCollection<FeedbackTimelineItemDto> Timeline,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset LastActivityAt,
|
||||
DateTimeOffset? CancelledAt,
|
||||
string? CancellationReason);
|
||||
|
||||
public record FeedbackTimelineItemDto(
|
||||
Guid Id,
|
||||
string Kind,
|
||||
Guid ActorUserId,
|
||||
string ActorDisplayName,
|
||||
string ActorEmail,
|
||||
string? ActorRole,
|
||||
string? Body,
|
||||
string? ActivityType,
|
||||
string? FromValue,
|
||||
string? ToValue,
|
||||
string? Note,
|
||||
DateTimeOffset CreatedAt);
|
||||
|
||||
public static class FeedbackDtoMapper
|
||||
{
|
||||
public static FeedbackReportDto ToDto(this FeedbackReport report)
|
||||
@@ -81,6 +96,12 @@ public static class FeedbackDtoMapper
|
||||
$"/api/feedback/{report.Id}/screenshot",
|
||||
report.Screenshot.CreatedAt),
|
||||
report.Tags.OrderBy(tag => tag.Name).Select(tag => tag.Name).ToArray(),
|
||||
report.Comments
|
||||
.Select(comment => comment.ToTimelineDto())
|
||||
.Concat(report.ActivityEntries.Select(activity => activity.ToTimelineDto()))
|
||||
.OrderBy(item => item.CreatedAt)
|
||||
.ThenBy(item => item.Kind)
|
||||
.ToArray(),
|
||||
report.CreatedAt,
|
||||
report.LastActivityAt,
|
||||
report.CancelledAt,
|
||||
@@ -96,4 +117,48 @@ public static class FeedbackDtoMapper
|
||||
{
|
||||
return status == FeedbackStatus.WontDo ? "Won't Do" : status.ToString();
|
||||
}
|
||||
|
||||
public static FeedbackTimelineItemDto ToTimelineDto(this FeedbackComment comment)
|
||||
{
|
||||
return new FeedbackTimelineItemDto(
|
||||
comment.Id,
|
||||
"Comment",
|
||||
comment.AuthorUserId,
|
||||
comment.AuthorDisplayName,
|
||||
comment.AuthorEmail,
|
||||
comment.AuthorRole,
|
||||
comment.Body,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
comment.CreatedAt);
|
||||
}
|
||||
|
||||
public static FeedbackTimelineItemDto ToTimelineDto(this FeedbackActivityEntry activity)
|
||||
{
|
||||
return new FeedbackTimelineItemDto(
|
||||
activity.Id,
|
||||
"Activity",
|
||||
activity.ActorUserId,
|
||||
activity.ActorDisplayName,
|
||||
activity.ActorEmail,
|
||||
null,
|
||||
null,
|
||||
activity.ActivityType,
|
||||
activity.FromValue,
|
||||
activity.ToValue,
|
||||
activity.Note,
|
||||
activity.CreatedAt);
|
||||
}
|
||||
|
||||
public static string ToFeedbackDisplayString(this FeedbackType type)
|
||||
{
|
||||
return ToDisplayString(type);
|
||||
}
|
||||
|
||||
public static string ToFeedbackDisplayString(this FeedbackStatus status)
|
||||
{
|
||||
return ToDisplayString(status);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user