You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
8 years ago
|
class Api::V1::StatusesController < ApiController
|
||
9 years ago
|
before_action :doorkeeper_authorize!
|
||
9 years ago
|
respond_to :json
|
||
|
|
||
|
def show
|
||
|
@status = Status.find(params[:id])
|
||
|
end
|
||
|
|
||
8 years ago
|
def context
|
||
|
@status = Status.find(params[:id])
|
||
8 years ago
|
@ancestors = @status.ancestors
|
||
|
@descendants = @status.descendants
|
||
8 years ago
|
end
|
||
|
|
||
9 years ago
|
def create
|
||
8 years ago
|
@status = PostStatusService.new.(current_user.account, params[:status], params[:in_reply_to_id].blank? ? nil : Status.find(params[:in_reply_to_id]), params[:media_ids])
|
||
9 years ago
|
render action: :show
|
||
|
end
|
||
|
|
||
8 years ago
|
def destroy
|
||
|
@status = Status.where(account_id: current_user.account).find(params[:id])
|
||
|
RemoveStatusService.new.(@status)
|
||
|
render_empty
|
||
|
end
|
||
|
|
||
9 years ago
|
def reblog
|
||
8 years ago
|
@status = ReblogService.new.(current_user.account, Status.find(params[:id])).reload
|
||
9 years ago
|
render action: :show
|
||
|
end
|
||
9 years ago
|
|
||
8 years ago
|
def unreblog
|
||
|
RemoveStatusService.new.(Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first!)
|
||
|
@status = Status.find(params[:id])
|
||
|
render action: :show
|
||
|
end
|
||
|
|
||
9 years ago
|
def favourite
|
||
8 years ago
|
@status = FavouriteService.new.(current_user.account, Status.find(params[:id])).status.reload
|
||
9 years ago
|
render action: :show
|
||
|
end
|
||
9 years ago
|
|
||
8 years ago
|
def unfavourite
|
||
|
@status = UnfavouriteService.new.(current_user.account, Status.find(params[:id])).status.reload
|
||
|
render action: :show
|
||
|
end
|
||
|
|
||
9 years ago
|
def home
|
||
8 years ago
|
@statuses = Feed.new(:home, current_user.account).get(20, params[:max_id]).to_a
|
||
9 years ago
|
end
|
||
|
|
||
|
def mentions
|
||
8 years ago
|
@statuses = Feed.new(:mentions, current_user.account).get(20, params[:max_id]).to_a
|
||
9 years ago
|
end
|
||
9 years ago
|
end
|