mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 10:29:53 +01:00
Make endpoint
and subscription
parameters required on web push endpoints
This commit is contained in:
parent
9fd3940b7d
commit
3105cb74b4
1 changed files with 4 additions and 2 deletions
|
@ -12,7 +12,7 @@ class Ajax::WebPushController < AjaxController
|
|||
end
|
||||
|
||||
def check
|
||||
params.permit(:endpoint)
|
||||
params.require(:endpoint)
|
||||
|
||||
found = current_user.web_push_subscriptions.where("subscription ->> 'endpoint' = ?", params[:endpoint]).first
|
||||
|
||||
|
@ -29,6 +29,8 @@ class Ajax::WebPushController < AjaxController
|
|||
end
|
||||
|
||||
def subscribe
|
||||
params.require(:subscription)
|
||||
|
||||
WebPushSubscription.create!(
|
||||
user: current_user,
|
||||
subscription: params[:subscription]
|
||||
|
@ -40,7 +42,7 @@ class Ajax::WebPushController < AjaxController
|
|||
end
|
||||
|
||||
def unsubscribe # rubocop:disable Metrics/AbcSize
|
||||
params.permit(:endpoint)
|
||||
params.require(:endpoint)
|
||||
|
||||
removed = if params.key?(:endpoint)
|
||||
current_user.web_push_subscriptions.where("subscription ->> 'endpoint' = ?", params[:endpoint]).destroy_all
|
||||
|
|
Loading…
Reference in a new issue