Change algorithm of follow recommendations (#28314)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
b7bdcd4f39
commit
b5ac61b2c5
35 changed files with 297 additions and 292 deletions
|
@ -3,22 +3,23 @@
|
|||
class Api::V1::SuggestionsController < Api::BaseController
|
||||
include Authorization
|
||||
|
||||
before_action -> { doorkeeper_authorize! :read }
|
||||
before_action -> { doorkeeper_authorize! :read, :'read:accounts' }, only: :index
|
||||
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, except: :index
|
||||
before_action :require_user!
|
||||
before_action :set_suggestions
|
||||
|
||||
def index
|
||||
suggestions = suggestions_source.get(current_account, limit: limit_param(DEFAULT_ACCOUNTS_LIMIT))
|
||||
render json: suggestions.map(&:account), each_serializer: REST::AccountSerializer
|
||||
render json: @suggestions.get(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:offset].to_i).map(&:account), each_serializer: REST::AccountSerializer
|
||||
end
|
||||
|
||||
def destroy
|
||||
suggestions_source.remove(current_account, params[:id])
|
||||
@suggestions.remove(params[:id])
|
||||
render_empty
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def suggestions_source
|
||||
AccountSuggestions::PastInteractionsSource.new
|
||||
def set_suggestions
|
||||
@suggestions = AccountSuggestions.new(current_account)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue