feat: update confirmation url
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class Facebook::ConfirmController < ApplicationController
|
||||
class InvalidDigestError < StandardError; end
|
||||
|
||||
def show
|
||||
@id_to_process = params[:id]
|
||||
|
||||
if processing?
|
||||
render json: { status: 'Processing' }, status: :ok
|
||||
else
|
||||
render json: { status: 'Data Deleted Successfully' }, status: :ok
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def processing?
|
||||
key = format(::Redis::Alfred::META_DELETE_PROCESSING, id: @id_to_process)
|
||||
::Redis::Alfred.get(key).present?
|
||||
end
|
||||
end
|
||||
@@ -6,9 +6,9 @@ class Facebook::DeleteController < ApplicationController
|
||||
payload = parse_fb_signed_request(signed_request)
|
||||
id_to_process = payload['user_id']
|
||||
|
||||
set_processing
|
||||
mark_processing(id_to_process)
|
||||
Webhooks::MetaDeleteJob.perform_later(id_to_process)
|
||||
status_url = "#{app_url_base}/facebook/confirm?code=#{id_to_process}"
|
||||
status_url = "#{app_url_base}/facebook/confirm/#{id_to_process}"
|
||||
|
||||
render json: { status_url: status_url, code: id_to_process }, status: :ok
|
||||
rescue InvalidDigestError
|
||||
@@ -17,7 +17,7 @@ class Facebook::DeleteController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def set_processing
|
||||
def mark_processing(id_to_process)
|
||||
# we use this key to check if the deletion is completed or not
|
||||
# Once the key is gone, we know the deletion is completed
|
||||
# And we can show as such
|
||||
|
||||
+2
-2
@@ -455,8 +455,8 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
namespace :facebook do
|
||||
resource :delete, only: [:create]
|
||||
resource :confirm, only: [:show]
|
||||
resources :delete, only: [:create]
|
||||
resources :confirm, only: [:show]
|
||||
end
|
||||
|
||||
namespace :linear do
|
||||
|
||||
Reference in New Issue
Block a user