mirror of
https://github.com/mastodon/mastodon.git
synced 2025-10-05 16:42:47 +00:00
Fix remaining hardcoded uses of account-dependent routes in ActivityPub code
Some checks failed
Chromatic / Run Chromatic (push) Has been cancelled
Some checks failed
Chromatic / Run Chromatic (push) Has been cancelled
This commit is contained in:
parent
0821514636
commit
212a3ef37c
|
@ -28,7 +28,7 @@ class ActivityPub::LikesController < ActivityPub::BaseController
|
||||||
|
|
||||||
def likes_collection_presenter
|
def likes_collection_presenter
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_status_likes_url(@account, @status),
|
id: ActivityPub::TagManager.instance.likes_uri_for(@status),
|
||||||
type: :unordered,
|
type: :unordered,
|
||||||
size: @status.favourites_count
|
size: @status.favourites_count
|
||||||
)
|
)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ActivityPub::RepliesController < ActivityPub::BaseController
|
||||||
|
|
||||||
def replies_collection_presenter
|
def replies_collection_presenter
|
||||||
page = ActivityPub::CollectionPresenter.new(
|
page = ActivityPub::CollectionPresenter.new(
|
||||||
id: account_status_replies_url(@account, @status, page_params),
|
id: ActivityPub::TagManager.instance.replies_uri_for(@status, page_params),
|
||||||
type: :unordered,
|
type: :unordered,
|
||||||
part_of: account_status_replies_url(@account, @status),
|
part_of: account_status_replies_url(@account, @status),
|
||||||
next: next_page,
|
next: next_page,
|
||||||
|
@ -47,7 +47,7 @@ class ActivityPub::RepliesController < ActivityPub::BaseController
|
||||||
return page if page_requested?
|
return page if page_requested?
|
||||||
|
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_status_replies_url(@account, @status),
|
id: ActivityPub::TagManager.instance.replies_uri_for(@status),
|
||||||
type: :unordered,
|
type: :unordered,
|
||||||
first: page
|
first: page
|
||||||
)
|
)
|
||||||
|
@ -66,8 +66,7 @@ class ActivityPub::RepliesController < ActivityPub::BaseController
|
||||||
# Only consider remote accounts
|
# Only consider remote accounts
|
||||||
return nil if @replies.size < DESCENDANTS_LIMIT
|
return nil if @replies.size < DESCENDANTS_LIMIT
|
||||||
|
|
||||||
account_status_replies_url(
|
ActivityPub::TagManager.instance.replies_uri_for(
|
||||||
@account,
|
|
||||||
@status,
|
@status,
|
||||||
page: true,
|
page: true,
|
||||||
min_id: @replies&.last&.id,
|
min_id: @replies&.last&.id,
|
||||||
|
@ -77,8 +76,7 @@ class ActivityPub::RepliesController < ActivityPub::BaseController
|
||||||
# For now, we're serving only self-replies, but next page might be other accounts
|
# For now, we're serving only self-replies, but next page might be other accounts
|
||||||
next_only_other_accounts = @replies&.last&.account_id != @account.id || @replies.size < DESCENDANTS_LIMIT
|
next_only_other_accounts = @replies&.last&.account_id != @account.id || @replies.size < DESCENDANTS_LIMIT
|
||||||
|
|
||||||
account_status_replies_url(
|
ActivityPub::TagManager.instance.replies_uri_for(
|
||||||
@account,
|
|
||||||
@status,
|
@status,
|
||||||
page: true,
|
page: true,
|
||||||
min_id: next_only_other_accounts ? nil : @replies&.last&.id,
|
min_id: next_only_other_accounts ? nil : @replies&.last&.id,
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ActivityPub::SharesController < ActivityPub::BaseController
|
||||||
|
|
||||||
def shares_collection_presenter
|
def shares_collection_presenter
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_status_shares_url(@account, @status),
|
id: ActivityPub::TagManager.instance.shares_uri_for(@status),
|
||||||
type: :unordered,
|
type: :unordered,
|
||||||
size: @status.reblogs_count
|
size: @status.reblogs_count
|
||||||
)
|
)
|
||||||
|
|
|
@ -60,17 +60,17 @@ class FollowerAccountsController < ApplicationController
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
if page_requested?
|
if page_requested?
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_followers_url(@account, page: params.fetch(:page, 1)),
|
id: page_url(params.fetch(:page, 1)),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.followers_count,
|
size: @account.followers_count,
|
||||||
items: follows.map { |follow| ActivityPub::TagManager.instance.uri_for(follow.account) },
|
items: follows.map { |follow| ActivityPub::TagManager.instance.uri_for(follow.account) },
|
||||||
part_of: account_followers_url(@account),
|
part_of: ActivityPub::TagManager.instance.followers_uri_for(@account),
|
||||||
next: next_page_url,
|
next: next_page_url,
|
||||||
prev: prev_page_url
|
prev: prev_page_url
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_followers_url(@account),
|
id: ActivityPub::TagManager.instance.followers_uri_for(@account),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.followers_count,
|
size: @account.followers_count,
|
||||||
first: page_url(1)
|
first: page_url(1)
|
||||||
|
|
|
@ -49,7 +49,7 @@ class FollowingAccountsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_url(page)
|
def page_url(page)
|
||||||
account_following_index_url(@account, page: page) unless page.nil?
|
ActivityPub::TagManager.instance.following_uri_for(@account, page: page) unless page.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_page_url
|
def next_page_url
|
||||||
|
@ -63,17 +63,17 @@ class FollowingAccountsController < ApplicationController
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
if page_requested?
|
if page_requested?
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_following_index_url(@account, page: params.fetch(:page, 1)),
|
id: page_url(params.fetch(:page, 1)),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.following_count,
|
size: @account.following_count,
|
||||||
items: follows.map { |follow| ActivityPub::TagManager.instance.uri_for(follow.target_account) },
|
items: follows.map { |follow| ActivityPub::TagManager.instance.uri_for(follow.target_account) },
|
||||||
part_of: account_following_index_url(@account),
|
part_of: ActivityPub::TagManager.instance.following_uri_for(@account),
|
||||||
next: next_page_url,
|
next: next_page_url,
|
||||||
prev: prev_page_url
|
prev: prev_page_url
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_following_index_url(@account),
|
id: ActivityPub::TagManager.instance.following_uri_for(@account),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.following_count,
|
size: @account.following_count,
|
||||||
first: page_url(1)
|
first: page_url(1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user