|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
# frozen_string_literal: true |
|
|
|
|
|
|
|
|
|
|
|
class Api::V1::TimelinesController < ApiController |
|
|
|
class Api::V1::TimelinesController < ApiController |
|
|
|
before_action -> { doorkeeper_authorize! :read } |
|
|
|
before_action -> { doorkeeper_authorize! :read } |
|
|
|
before_action :require_user!, only: [:home, :mentions] |
|
|
|
before_action :require_user!, only: [:home, :mentions] |
|
|
@ -10,7 +12,7 @@ class Api::V1::TimelinesController < ApiController |
|
|
|
set_maps(@statuses) |
|
|
|
set_maps(@statuses) |
|
|
|
|
|
|
|
|
|
|
|
next_path = api_v1_home_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
next_path = api_v1_home_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
prev_path = api_v1_home_timeline_url(since_id: @statuses.first.id) if @statuses.size > 0 |
|
|
|
prev_path = api_v1_home_timeline_url(since_id: @statuses.first.id) unless @statuses.empty? |
|
|
|
|
|
|
|
|
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
|
|
|
|
|
|
|
@ -23,7 +25,7 @@ class Api::V1::TimelinesController < ApiController |
|
|
|
set_maps(@statuses) |
|
|
|
set_maps(@statuses) |
|
|
|
|
|
|
|
|
|
|
|
next_path = api_v1_mentions_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
next_path = api_v1_mentions_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
prev_path = api_v1_mentions_timeline_url(since_id: @statuses.first.id) if @statuses.size > 0 |
|
|
|
prev_path = api_v1_mentions_timeline_url(since_id: @statuses.first.id) unless @statuses.empty? |
|
|
|
|
|
|
|
|
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
|
|
|
|
|
|
|
@ -36,7 +38,7 @@ class Api::V1::TimelinesController < ApiController |
|
|
|
set_maps(@statuses) |
|
|
|
set_maps(@statuses) |
|
|
|
|
|
|
|
|
|
|
|
next_path = api_v1_public_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
next_path = api_v1_public_timeline_url(max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
prev_path = api_v1_public_timeline_url(since_id: @statuses.first.id) if @statuses.size > 0 |
|
|
|
prev_path = api_v1_public_timeline_url(since_id: @statuses.first.id) unless @statuses.empty? |
|
|
|
|
|
|
|
|
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
|
|
|
|
|
|
|
@ -50,7 +52,7 @@ class Api::V1::TimelinesController < ApiController |
|
|
|
set_maps(@statuses) |
|
|
|
set_maps(@statuses) |
|
|
|
|
|
|
|
|
|
|
|
next_path = api_v1_hashtag_timeline_url(params[:id], max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
next_path = api_v1_hashtag_timeline_url(params[:id], max_id: @statuses.last.id) if @statuses.size == DEFAULT_STATUSES_LIMIT |
|
|
|
prev_path = api_v1_hashtag_timeline_url(params[:id], since_id: @statuses.first.id) if @statuses.size > 0 |
|
|
|
prev_path = api_v1_hashtag_timeline_url(params[:id], since_id: @statuses.first.id) unless @statuses.empty? |
|
|
|
|
|
|
|
|
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
set_pagination_headers(next_path, prev_path) |
|
|
|
|
|
|
|
|
|
|
|