about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-07-07 21:09:54 +0200
committerGitHub <noreply@github.com>2018-07-07 21:09:54 +0200
commit6b9e03e002ed349fd8b7e2879d599bb75a698eb2 (patch)
tree95274f35902ac1e997e7bb43ca36e78be89496e2 /app
parentef2bcf51d70b035407dffed8c40efee999f18115 (diff)
Add API method to remove a suggestion (#7978)
DELETE /api/v1/suggestions/:account_id

When blocking, remove suggestion from both sides. Muting not affected,
since muting is supposed to be invisible to the target.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/suggestions_controller.rb5
-rw-r--r--app/models/concerns/account_interactions.rb3
2 files changed, 7 insertions, 1 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