Retrospring/app/controllers/timeline_controller.rb

40 lines
1.2 KiB
Ruby
Raw Normal View History

2022-07-18 07:26:11 -07:00
# frozen_string_literal: true
class TimelineController < ApplicationController
before_action :authenticate_user!
def index
@timeline = current_user.cursored_timeline(last_id: params[:last_id])
@timeline_last_id = @timeline.map(&:id).min
@more_data_available = !current_user.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 list
2022-07-18 13:27:31 -07:00
@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
2022-07-18 07:26:11 -07:00
end