diff --git a/internal/gtsmodel/notification.go b/internal/gtsmodel/notification.go index c585e75c3..edadb9b3d 100644 --- a/internal/gtsmodel/notification.go +++ b/internal/gtsmodel/notification.go @@ -56,7 +56,8 @@ type Notification struct { NotificationPendingReply NotificationType = 10 // NotificationPendingReply -- Someone has replied to a status of yours, which requires approval by you. NotificationPendingReblog NotificationType = 11 // NotificationPendingReblog -- Someone has boosted a status of yours, which requires approval by you. NotificationAdminReport NotificationType = 12 // NotificationAdminReport -- someone has submitted a new report to the instance. - NotificationTypeNumValues NotificationType = 13 // NotificationTypeNumValues -- 1 + number of max notification type + NotificationUpdate NotificationType = 13 + NotificationTypeNumValues NotificationType = 14 // NotificationTypeNumValues -- 1 + number of max notification type ) // String returns a stringified, frontend API compatible form of NotificationType. @@ -86,6 +87,8 @@ func (t NotificationType) String() string { return "pending.reblog" case NotificationAdminReport: return "admin.report" + case NotificationUpdate: + return "update" default: panic("invalid notification type") } @@ -118,6 +121,8 @@ func ParseNotificationType(in string) NotificationType { return NotificationPendingReblog case "admin.report": return NotificationAdminReport + case "update": + return NotificationUpdate default: return NotificationUnknown } diff --git a/internal/processing/push/push.go b/internal/processing/push/push.go index 0a8b1ca8d..7635229fa 100644 --- a/internal/processing/push/push.go +++ b/internal/processing/push/push.go @@ -76,8 +76,7 @@ func alertsToNotificationFlags(alerts *apimodel.WebPushSubscriptionAlerts) gtsmo n.Set(gtsmodel.NotificationReblog, alerts.Reblog) n.Set(gtsmodel.NotificationPoll, alerts.Poll) n.Set(gtsmodel.NotificationStatus, alerts.Status) - // TODO: (Vyr) handle NotificationUpdate when edit patch is merged - //n.Set(gtsmodel.NotificationUpdate, alerts.Update) + n.Set(gtsmodel.NotificationUpdate, alerts.Update) n.Set(gtsmodel.NotificationAdminSignup, alerts.AdminSignup) n.Set(gtsmodel.NotificationAdminReport, alerts.AdminReport) n.Set(gtsmodel.NotificationPendingFave, alerts.PendingFavourite) diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 7b8a210fe..aea98a7f0 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -2964,7 +2964,7 @@ func (c *Converter) WebPushSubscriptionToAPIWebPushSubscription( Reblog: subscription.NotificationFlags.Get(gtsmodel.NotificationReblog), Poll: subscription.NotificationFlags.Get(gtsmodel.NotificationPoll), Status: subscription.NotificationFlags.Get(gtsmodel.NotificationStatus), - Update: false, // TODO: (Vyr) handle NotificationUpdate when edit patch is merged + Update: subscription.NotificationFlags.Get(gtsmodel.NotificationUpdate), AdminSignup: subscription.NotificationFlags.Get(gtsmodel.NotificationAdminSignup), AdminReport: subscription.NotificationFlags.Get(gtsmodel.NotificationAdminReport), PendingFavourite: subscription.NotificationFlags.Get(gtsmodel.NotificationPendingFave), diff --git a/testrig/testmodels.go b/testrig/testmodels.go index d8db8cc40..5670cfc0d 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -3603,7 +3603,7 @@ func NewTestWebPushSubscriptions() map[string]*gtsmodel.WebPushSubscription { gtsmodel.NotificationReblog, gtsmodel.NotificationPoll, gtsmodel.NotificationStatus, - // TODO: (Vyr) add NotificationUpdate when edit patch is merged + gtsmodel.NotificationUpdate, gtsmodel.NotificationAdminSignup, gtsmodel.NotificationAdminReport, gtsmodel.NotificationPendingFave,