Skip to content

Commit 6f43e3e

Browse files
authored
Merge pull request #35 from slarkerino/update-private-message
feat: add category to pm
2 parents 4b21d6f + 56f181d commit 6f43e3e

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

providers/PrivateMessaing/EasyAbp.NotificationService.Provider.PrivateMessaging.Abstractions/EasyAbp/NotificationService/Provider/PrivateMessaging/CreateNotificationInfoModelExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,14 @@ public static bool GetSendFromCreator(this CreateNotificationInfoModel model)
3535
{
3636
return (bool)model.GetProperty(nameof(CreatePrivateMessageNotificationEto.SendFromCreator));
3737
}
38+
39+
public static void SetCategory(this CreateNotificationInfoModel model, [CanBeNull] string category)
40+
{
41+
model.SetProperty(nameof(CreatePrivateMessageNotificationEto.Category), category);
42+
}
43+
44+
public static string GetCategory(this CreateNotificationInfoModel model)
45+
{
46+
return (string)model.GetProperty(nameof(CreatePrivateMessageNotificationEto.Category));
47+
}
3848
}

providers/PrivateMessaing/EasyAbp.NotificationService.Provider.PrivateMessaging.Abstractions/EasyAbp/NotificationService/Provider/PrivateMessaging/CreatePrivateMessageNotificationEto.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ public bool SendFromCreator
3232
set => this.SetSendFromCreator(value);
3333
}
3434

35+
[CanBeNull]
36+
public string Category
37+
{
38+
get => this.GetCategory();
39+
set => this.SetCategory(value);
40+
}
41+
3542
public CreatePrivateMessageNotificationEto()
3643
{
3744
}

providers/PrivateMessaing/EasyAbp.NotificationService.Provider.PrivateMessaging.Abstractions/EasyAbp/NotificationService/Provider/PrivateMessaging/NotificationProviderPrivateMessagingConsts.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ public static class NotificationProviderPrivateMessagingConsts
1111
public const string NotificationInfoSendFromCreatorPropertyName = "SendFromCreator";
1212

1313
public const string NotificationIdPropertyName = "NotificationId";
14+
15+
public const string NotificationInfoCategoryPropertyName = "Category";
1416
}
1517
}

providers/PrivateMessaing/EasyAbp.NotificationService.Provider.PrivateMessaging/EasyAbp/NotificationService/Provider/PrivateMessaging/NotificationInfoExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace EasyAbp.NotificationService.Provider.PrivateMessaging;
66
public static class NotificationInfoExtensions
77
{
88
public static void SetPrivateMessagingData(this NotificationInfo notificationInfo, [NotNull] string title,
9-
[CanBeNull] string content, bool sendFromCreator)
9+
[CanBeNull] string content, bool sendFromCreator, [CanBeNull] string category = null)
1010
{
1111
notificationInfo.SetDataValue(NotificationProviderPrivateMessagingConsts.NotificationInfoTitlePropertyName,
1212
title);
@@ -15,6 +15,9 @@ public static void SetPrivateMessagingData(this NotificationInfo notificationInf
1515
notificationInfo.SetDataValue(
1616
NotificationProviderPrivateMessagingConsts.NotificationInfoSendFromCreatorPropertyName,
1717
sendFromCreator);
18+
notificationInfo.SetDataValue(
19+
NotificationProviderPrivateMessagingConsts.NotificationInfoCategoryPropertyName,
20+
category);
1821
}
1922

2023
public static string GetPrivateMessagingTitle(this NotificationInfo notificationInfo)
@@ -34,4 +37,10 @@ public static bool GetPrivateMessagingSendFromCreator(this NotificationInfo noti
3437
return (bool)notificationInfo.GetDataValue(NotificationProviderPrivateMessagingConsts
3538
.NotificationInfoSendFromCreatorPropertyName);
3639
}
40+
41+
public static string GetPrivateMessagingCategory(this NotificationInfo notificationInfo)
42+
{
43+
return (string)notificationInfo.GetDataValue(NotificationProviderPrivateMessagingConsts
44+
.NotificationInfoCategoryPropertyName);
45+
}
3746
}

providers/PrivateMessaing/EasyAbp.NotificationService.Provider.PrivateMessaging/EasyAbp/NotificationService/Provider/PrivateMessaging/PrivateMessageNotificationManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class PrivateMessageNotificationManager : NotificationManagerBase
2525
{
2626
var notificationInfo = new NotificationInfo(GuidGenerator.Create(), CurrentTenant.Id);
2727

28-
notificationInfo.SetPrivateMessagingData(model.GetTitle(), model.GetContent(), model.GetSendFromCreator());
28+
notificationInfo.SetPrivateMessagingData(model.GetTitle(), model.GetContent(), model.GetSendFromCreator(), model.GetCategory());
2929

3030
var notifications = await CreateNotificationsAsync(notificationInfo, model);
3131

@@ -38,7 +38,8 @@ protected override async Task SendNotificationAsync(Notification notification, N
3838
notificationInfo.GetPrivateMessagingSendFromCreator() ? notification.CreatorId : null,
3939
notification.UserId,
4040
notificationInfo.GetPrivateMessagingTitle(),
41-
notificationInfo.GetPrivateMessagingContent());
41+
notificationInfo.GetPrivateMessagingContent(),
42+
notificationInfo.GetPrivateMessagingCategory());
4243

4344
model.SetProperty(NotificationProviderPrivateMessagingConsts.NotificationIdPropertyName, notification.Id);
4445

0 commit comments

Comments
 (0)