about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-02-23 16:45:22 +0100
committerGitHub <noreply@github.com>2022-02-23 16:45:22 +0100
commit7b816eb5aeeed61fa1e3a7c95cbb5bb7978f7fa5 (patch)
tree5888b4ec8bbb68d88c527ec8dada549f4a6c9b77 /app/controllers
parent3e12abc1fe9b32f69eaf2a8d1edf8bad9622eb4a (diff)
Add notifications for new sign-ups (#16953)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/web/push_subscriptions_controller.rb23
1 files changed, 2 insertions, 21 deletions
diff --git a/app/controllers/api/web/push_subscriptions_controller.rb b/app/controllers/api/web/push_subscriptions_controller.rb
index db2512e5f..5167928e9 100644
--- a/app/controllers/api/web/push_subscriptions_controller.rb
+++ b/app/controllers/api/web/push_subscriptions_controller.rb
@@ -17,17 +17,7 @@ class Api::Web::PushSubscriptionsController < Api::Web::BaseController
 
     data = {
       policy: 'all',
-
-      alerts: {
-        follow: alerts_enabled,
-        follow_request: alerts_enabled,
-        favourite: alerts_enabled,
-        reblog: alerts_enabled,
-        mention: alerts_enabled,
-        poll: alerts_enabled,
-        status: alerts_enabled,
-        update: alerts_enabled,
-      },
+      alerts: Notification::TYPES.index_with { alerts_enabled },
     }
 
     data.deep_merge!(data_params) if params[:data]
@@ -62,15 +52,6 @@ class Api::Web::PushSubscriptionsController < Api::Web::BaseController
   end
 
   def data_params
-    @data_params ||= params.require(:data).permit(:policy, alerts: [
-      :follow,
-      :follow_request,
-      :favourite,
-      :reblog,
-      :mention,
-      :poll,
-      :status,
-      :update,
-    ])
+    @data_params ||= params.require(:data).permit(:policy, alerts: Notification::TYPES)
   end
 end