Move public & list timelines into `TimelineController`
This commit is contained in:
parent
98d7bec924
commit
6344b55b44
|
@ -1,15 +0,0 @@
|
|||
class ListController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
@list = current_user.lists.find_by_name!(params[:list_name])
|
||||
@timeline = @list.cursored_timeline(last_id: params[:last_id])
|
||||
@timeline_last_id = @timeline.map(&:id).min
|
||||
@more_data_available = !@list.cursored_timeline(last_id: @timeline_last_id, size: 1).count.zero?
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
class PublicController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
@timeline = Answer.cursored_public_timeline(last_id: params[:last_id])
|
||||
@timeline_last_id = @timeline.map(&:id).min
|
||||
@more_data_available = !Answer.cursored_public_timeline(last_id: @timeline_last_id, size: 1).count.zero?
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,4 +13,27 @@ class TimelineController < ApplicationController
|
|||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def list
|
||||
@list = current_user.lists.find_by_name!(params[:list_name])
|
||||
@timeline = @list.cursored_timeline(last_id: params[:last_id])
|
||||
@timeline_last_id = @timeline.map(&:id).min
|
||||
@more_data_available = !@list.cursored_timeline(last_id: @timeline_last_id, size: 1).count.zero?
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def public
|
||||
@timeline = Answer.cursored_public_timeline(last_id: params[:last_id])
|
||||
@timeline_last_id = @timeline.map(&:id).min
|
||||
@more_data_available = !Answer.cursored_public_timeline(last_id: @timeline_last_id, size: 1).count.zero?
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js { render layout: false }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -138,8 +138,8 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
match '/discover', to: 'discover#index', via: :get, as: :discover
|
||||
match '/public', to: 'public#index', via: :get, as: :public_timeline if APP_CONFIG.dig(:features, :public, :enabled)
|
||||
match '/list/:list_name', to: 'list#index', via: :get, as: :list_timeline
|
||||
match '/public', to: 'timeline#public', via: :get, as: :public_timeline if APP_CONFIG.dig(:features, :public, :enabled)
|
||||
match '/list/:list_name', to: 'timeline#list', via: :get, as: :list_timeline
|
||||
|
||||
match '/notifications(/:type)', to: 'notifications#index', via: :get, as: :notifications, defaults: {type: 'new'}
|
||||
|
||||
|
|
Loading…
Reference in New Issue