diff options
author | 2025-02-03 02:25:53 -0800 | |
---|---|---|
committer | 2025-02-03 10:25:53 +0000 | |
commit | 27844b7da2567491661f9ddd2d4662f9f1b3ce40 (patch) | |
tree | 1832fe4ec4d3a0fbf6d01bcb5f39acf6885cc1f5 /internal/api/model | |
parent | [chore]: Bump github.com/tdewolff/minify/v2 from 2.21.2 to 2.21.3 (#3727) (diff) | |
download | gotosocial-27844b7da2567491661f9ddd2d4662f9f1b3ce40.tar.xz |
[feature] Implement Web Push notification policy (#3721)
* Web Push: add policy column to subscriptions
* Web Push: add policy to API
* Web Push: test notification policy
* go-fmt unrelated file (how did this get thru?)
Diffstat (limited to 'internal/api/model')
-rw-r--r-- | internal/api/model/webpushsubscription.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/api/model/webpushsubscription.go b/internal/api/model/webpushsubscription.go index a28bb7294..38d6cf7ed 100644 --- a/internal/api/model/webpushsubscription.go +++ b/internal/api/model/webpushsubscription.go @@ -138,6 +138,8 @@ type WebPushSubscriptionUpdateRequest struct { DataAlertsPendingFavourite *bool `form:"data[alerts][pending.favourite]" json:"-"` DataAlertsPendingReply *bool `form:"data[alerts][pending.reply]" json:"-"` DataAlertsPendingReblog *bool `form:"data[alerts][pending.reblog]" json:"-"` + + DataPolicy *WebPushNotificationPolicy `form:"data[policy]" json:"-"` } // WebPushSubscriptionRequestData is the part of a Web Push subscription that can be changed after creation. @@ -146,6 +148,9 @@ type WebPushSubscriptionUpdateRequest struct { type WebPushSubscriptionRequestData struct { // Alerts selects the specific events that this Web Push subscription will receive. Alerts *WebPushSubscriptionAlerts `form:"-" json:"alerts"` + + // Policy selects which accounts will trigger Web Push notifications. + Policy *WebPushNotificationPolicy `form:"-" json:"policy"` } // WebPushNotificationPolicy names sets of accounts that can generate notifications. @@ -154,4 +159,10 @@ type WebPushNotificationPolicy string const ( // WebPushNotificationPolicyAll allows all accounts to send notifications to the subscribing user. WebPushNotificationPolicyAll WebPushNotificationPolicy = "all" + // WebPushNotificationPolicyFollowed allows accounts followed by the subscribing user to send notifications. + WebPushNotificationPolicyFollowed WebPushNotificationPolicy = "followed" + // WebPushNotificationPolicyFollower allows accounts following the subscribing user to send notifications. + WebPushNotificationPolicyFollower WebPushNotificationPolicy = "follower" + // WebPushNotificationPolicyNone doesn't allow any acounts to send notifications to the subscribing user. + WebPushNotificationPolicyNone WebPushNotificationPolicy = "none" ) |