Added verified accounts/suggestions panel, updated suggestions route

• Added:
- verified accounts/suggestions panel

• Updated:
- suggestions route
This commit is contained in:
mgabdev
2020-07-01 21:36:53 -04:00
parent 095e646661
commit f41274efc7
6 changed files with 227 additions and 58 deletions

View File

@@ -5,12 +5,21 @@ class Api::V1::SuggestionsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :require_user!
before_action :set_accounts
respond_to :json
def index
render json: @accounts, each_serializer: REST::AccountSerializer
type = params[:type]
if type == 'related'
@accounts = PotentialFriendshipTracker.get(current_account.id)
render json: @accounts, each_serializer: REST::AccountSerializer
elsif type == 'verified'
@accounts = VerifiedSuggestions.get(current_account.id)
render json: @accounts, each_serializer: REST::AccountSerializer
else
raise GabSocial::NotPermittedError
end
end
def destroy
@@ -18,9 +27,4 @@ class Api::V1::SuggestionsController < Api::BaseController
render_empty
end
private
def set_accounts
@accounts = PotentialFriendshipTracker.get(current_account.id)
end
end