forked from cybrespace/mastodon
Fix wrong link header on followers API, wrong link in tabs component, order
account results
This commit is contained in:
parent
f8f15e5697
commit
cea28e0c1d
|
@ -14,6 +14,7 @@ const tabStyle = {
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
|
textAlign: 'center',
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
borderBottom: '2px solid #373b4a'
|
borderBottom: '2px solid #373b4a'
|
||||||
|
@ -30,7 +31,7 @@ const TabsBar = () => {
|
||||||
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/statuses/new'><i className='fa fa-fw fa-pencil' /> Compose</Link>
|
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/statuses/new'><i className='fa fa-fw fa-pencil' /> Compose</Link>
|
||||||
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/timelines/home'><i className='fa fa-fw fa-home' /> Home</Link>
|
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/timelines/home'><i className='fa fa-fw fa-home' /> Home</Link>
|
||||||
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/timelines/mentions'><i className='fa fa-fw fa-at' /> Mentions</Link>
|
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/timelines/mentions'><i className='fa fa-fw fa-at' /> Mentions</Link>
|
||||||
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/timelines/all'><i className='fa fa-fw fa-globe' /> Public</Link>
|
<Link style={tabStyle} activeStyle={tabActiveStyle} to='/timelines/public'><i className='fa fa-fw fa-globe' /> Public</Link>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,8 @@ class Api::V1::AccountsController < ApiController
|
||||||
|
|
||||||
def following
|
def following
|
||||||
results = Follow.where(account: @account).paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
results = Follow.where(account: @account).paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
||||||
@accounts = Account.where(id: results.map(&:target_account_id)).with_counters.to_a
|
accounts = Account.where(id: results.map(&:target_account_id)).with_counters.map { |a| [a.id, a] }.to_h
|
||||||
|
@accounts = results.map { |f| accounts[f.target_account_id] }
|
||||||
|
|
||||||
next_path = following_api_v1_account_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
next_path = following_api_v1_account_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
||||||
prev_path = following_api_v1_account_url(since_id: results.first.id) if results.size > 0
|
prev_path = following_api_v1_account_url(since_id: results.first.id) if results.size > 0
|
||||||
|
@ -28,10 +29,11 @@ class Api::V1::AccountsController < ApiController
|
||||||
|
|
||||||
def followers
|
def followers
|
||||||
results = Follow.where(target_account: @account).paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
results = Follow.where(target_account: @account).paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
||||||
@accounts = Account.where(id: results.map(&:account_id)).with_counters.to_a
|
accounts = Account.where(id: results.map(&:account_id)).with_counters.map { |a| [a.id, a] }.to_h
|
||||||
|
@accounts = results.map { |f| accounts[f.account_id] }
|
||||||
|
|
||||||
next_path = following_api_v1_account_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
next_path = followers_api_v1_account_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
||||||
prev_path = following_api_v1_account_url(since_id: results.first.id) if results.size > 0
|
prev_path = followers_api_v1_account_url(since_id: results.first.id) if results.size > 0
|
||||||
|
|
||||||
set_pagination_headers(next_path, prev_path)
|
set_pagination_headers(next_path, prev_path)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ class Api::V1::StatusesController < ApiController
|
||||||
|
|
||||||
def reblogged_by
|
def reblogged_by
|
||||||
results = @status.reblogs.paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
results = @status.reblogs.paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
||||||
@accounts = Account.where(id: results.map(&:account_id)).with_counters.to_a
|
accounts = Account.where(id: results.map(&:account_id)).with_counters.map { |a| [a.id, a] }.to_h
|
||||||
|
@accounts = results.map { |r| accounts[r.account_id] }
|
||||||
|
|
||||||
next_path = reblogged_by_api_v1_status_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
next_path = reblogged_by_api_v1_status_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
||||||
prev_path = reblogged_by_api_v1_status_url(since_id: results.first.id) if results.size > 0
|
prev_path = reblogged_by_api_v1_status_url(since_id: results.first.id) if results.size > 0
|
||||||
|
@ -28,7 +29,8 @@ class Api::V1::StatusesController < ApiController
|
||||||
|
|
||||||
def favourited_by
|
def favourited_by
|
||||||
results = @status.favourites.paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
results = @status.favourites.paginate_by_max_id(DEFAULT_ACCOUNTS_LIMIT, params[:max_id], params[:since_id])
|
||||||
@accounts = Account.where(id: results.map(&:account_id)).with_counters.to_a
|
accounts = Account.where(id: results.map(&:account_id)).with_counters.map { |a| [a.id, a] }.to_h
|
||||||
|
@accounts = results.map { |f| accounts[f.account_id] }
|
||||||
|
|
||||||
next_path = favourited_by_api_v1_status_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
next_path = favourited_by_api_v1_status_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
|
||||||
prev_path = favourited_by_api_v1_status_url(since_id: results.first.id) if results.size > 0
|
prev_path = favourited_by_api_v1_status_url(since_id: results.first.id) if results.size > 0
|
||||||
|
|
Loading…
Reference in New Issue