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.
This commit is contained in:
Eugen Rochko 2018-07-07 21:09:54 +02:00 committed by GitHub
parent ef2bcf51d7
commit 6b9e03e002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -13,6 +13,11 @@ class Api::V1::SuggestionsController < Api::BaseController
render json: @accounts, each_serializer: REST::AccountSerializer render json: @accounts, each_serializer: REST::AccountSerializer
end end
def destroy
PotentialFriendshipTracker.remove(current_account.id, params[:id])
render_empty
end
private private
def set_accounts def set_accounts

View file

@ -203,7 +203,8 @@ module AccountInteractions
private private
def remove_potential_friendship(other_account) def remove_potential_friendship(other_account, mutual = false)
PotentialFriendshipTracker.remove(id, other_account.id) PotentialFriendshipTracker.remove(id, other_account.id)
PotentialFriendshipTracker.remove(other_account.id, id) if mutual
end end
end end

View file

@ -246,7 +246,7 @@ Rails.application.routes.draw do
resources :streaming, only: [:index] resources :streaming, only: [:index]
resources :custom_emojis, only: [:index] resources :custom_emojis, only: [:index]
resources :suggestions, only: [:index] resources :suggestions, only: [:index, :destroy]
get '/search', to: 'search#index', as: :search get '/search', to: 'search#index', as: :search