0
0
Fork 0

Fix #463 - Fetch and display previews of URLs using OpenGraph tags

This commit is contained in:
Eugen Rochko 2017-01-20 01:00:14 +01:00
parent 8d0284f8d9
commit f0de621e76
26 changed files with 302 additions and 7 deletions

View file

@ -3,8 +3,8 @@
class Api::V1::StatusesController < ApiController
before_action -> { doorkeeper_authorize! :read }, except: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite]
before_action -> { doorkeeper_authorize! :write }, only: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite]
before_action :require_user!, except: [:show, :context, :reblogged_by, :favourited_by]
before_action :set_status, only: [:show, :context, :reblogged_by, :favourited_by]
before_action :require_user!, except: [:show, :context, :card, :reblogged_by, :favourited_by]
before_action :set_status, only: [:show, :context, :card, :reblogged_by, :favourited_by]
respond_to :json
@ -21,6 +21,10 @@ class Api::V1::StatusesController < ApiController
set_counters_maps(statuses)
end
def card
@card = PreviewCard.find_by!(status: @status)
end
def reblogged_by
results = @status.reblogs.paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
accounts = Account.where(id: results.map(&:account_id)).map { |a| [a.id, a] }.to_h