mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Fix default max_id query in paginate_by_max_id
This commit is contained in:
parent
12559b01ea
commit
082e1cbe5a
@ -15,7 +15,7 @@ class Api::AccountsController < ApiController
|
||||
end
|
||||
|
||||
def statuses
|
||||
@statuses = @account.statuses.with_includes.with_counters.paginate_by_max_id(20, params[:max_id])
|
||||
@statuses = @account.statuses.with_includes.with_counters.paginate_by_max_id(20, params[:max_id] || nil)
|
||||
end
|
||||
|
||||
def follow
|
||||
|
@ -17,7 +17,7 @@ class Status < ActiveRecord::Base
|
||||
|
||||
scope :with_counters, -> { select('statuses.*, (select count(r.id) from statuses as r where r.reblog_of_id = statuses.id) as reblogs_count, (select count(f.id) from favourites as f where f.status_id = statuses.id) as favourites_count') }
|
||||
scope :with_includes, -> { includes(:account, reblog: :account, thread: :account) }
|
||||
scope :paginate_by_max_id, -> (limit, max_id) { order('id desc').limit(limit).where('id < ?', max_id) }
|
||||
scope :paginate_by_max_id, -> (limit, max_id) { order('id desc').limit(limit).where(max_id.nil? ? '1=1' : ['id < ?', max_id]) }
|
||||
|
||||
def local?
|
||||
self.uri.nil?
|
||||
|
Loading…
Reference in New Issue
Block a user