summaryrefslogtreecommitdiff
path: root/internal/typeutils/frontendtointernal.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2025-02-03 02:25:53 -0800
committerLibravatar GitHub <noreply@github.com>2025-02-03 10:25:53 +0000
commit27844b7da2567491661f9ddd2d4662f9f1b3ce40 (patch)
tree1832fe4ec4d3a0fbf6d01bcb5f39acf6885cc1f5 /internal/typeutils/frontendtointernal.go
parent[chore]: Bump github.com/tdewolff/minify/v2 from 2.21.2 to 2.21.3 (#3727) (diff)
downloadgotosocial-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/typeutils/frontendtointernal.go')
-rw-r--r--internal/typeutils/frontendtointernal.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/typeutils/frontendtointernal.go b/internal/typeutils/frontendtointernal.go
index 82957ee05..b341aa6ae 100644
--- a/internal/typeutils/frontendtointernal.go
+++ b/internal/typeutils/frontendtointernal.go
@@ -231,3 +231,17 @@ func APIInteractionPolicyToInteractionPolicy(
},
}, nil
}
+
+func APIWebPushNotificationPolicyToWebPushNotificationPolicy(policy apimodel.WebPushNotificationPolicy) gtsmodel.WebPushNotificationPolicy {
+ switch policy {
+ case apimodel.WebPushNotificationPolicyAll:
+ return gtsmodel.WebPushNotificationPolicyAll
+ case apimodel.WebPushNotificationPolicyFollowed:
+ return gtsmodel.WebPushNotificationPolicyFollowed
+ case apimodel.WebPushNotificationPolicyFollower:
+ return gtsmodel.WebPushNotificationPolicyFollower
+ case apimodel.WebPushNotificationPolicyNone:
+ return gtsmodel.WebPushNotificationPolicyNone
+ }
+ return 0
+}