about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/api/v1/suggestions_controller.rb5
-rw-r--r--app/models/concerns/account_interactions.rb3
-rw-r--r--config/routes.rb2
3 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/api/v1/suggestions_controller.rb b/app/controllers/api/v1/suggestions_controller.rb
index 3abccedd5..9da2b60ae 100644
--- a/app/controllers/api/v1/suggestions_controller.rb
+++ b/app/controllers/api/v1/suggestions_controller.rb
@@ -13,6 +13,11 @@ class Api::V1::SuggestionsController < Api::BaseController
     render json: @accounts, each_serializer: REST::AccountSerializer
   end
 
+  def destroy
+    PotentialFriendshipTracker.remove(current_account.id, params[:id])
+    render_empty
+  end
+
   private
 
   def set_accounts
diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb
index ee435f956..e14e041f6 100644
--- a/app/models/concerns/account_interactions.rb
+++ b/app/models/concerns/account_interactions.rb
@@ -203,7 +203,8 @@ module AccountInteractions
 
   private
 
-  def remove_potential_friendship(other_account)
+  def remove_potential_friendship(other_account, mutual = false)
     PotentialFriendshipTracker.remove(id, other_account.id)
+    PotentialFriendshipTracker.remove(other_account.id, id) if mutual
   end
 end
diff --git a/config/routes.rb b/config/routes.rb
index e59325964..fd26b4aa7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -246,7 +246,7 @@ Rails.application.routes.draw do
 
       resources :streaming, only: [:index]
       resources :custom_emojis, only: [:index]
-      resources :suggestions, only: [:index]
+      resources :suggestions, only: [:index, :destroy]
 
       get '/search', to: 'search#index', as: :search