mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 18:45:41 +01:00
[Broken WiP] Use /s/:id
instead of /u/:account_id/statuses/:id
for statuses in new scheme
This commit is contained in:
parent
9376a217ab
commit
6fe4064b3f
2 changed files with 29 additions and 18 deletions
|
@ -47,9 +47,9 @@ class ActivityPub::TagManager
|
|||
end
|
||||
when :note, :comment, :activity
|
||||
if target.account.numeric_ap_id?
|
||||
return activity_numeric_account_status_url(target.account, target) if target.reblog?
|
||||
return activity_numeric_status_url(target.account, target) if target.reblog?
|
||||
|
||||
numeric_account_status_url(target.account.id, target)
|
||||
numeric_status_url(target)
|
||||
else
|
||||
return activity_account_status_url(target.account, target) if target.reblog?
|
||||
|
||||
|
@ -81,25 +81,25 @@ class ActivityPub::TagManager
|
|||
def activity_uri_for(target)
|
||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
||||
|
||||
target.account.numeric_ap_id? ? activity_numeric_account_status_url(target.account.id, target) : activity_account_status_url(target.account, target)
|
||||
target.account.numeric_ap_id? ? activity_numeric_status_url(target) : activity_account_status_url(target.account, target)
|
||||
end
|
||||
|
||||
def replies_uri_for(target, page_params = nil)
|
||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
||||
|
||||
target.account.numeric_ap_id? ? numeric_account_status_replies_url(target.account.id, target, page_params) : account_status_replies_url(target.account, target, page_params)
|
||||
target.account.numeric_ap_id? ? numeric_status_replies_url(target, page_params) : account_status_replies_url(target.account, target, page_params)
|
||||
end
|
||||
|
||||
def likes_uri_for(target)
|
||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
||||
|
||||
target.account.numeric_ap_id? ? numeric_account_status_likes_url(target.account.id, target) : account_status_likes_url(target.account, target)
|
||||
target.account.numeric_ap_id? ? numeric_status_likes_url(target) : account_status_likes_url(target.account, target)
|
||||
end
|
||||
|
||||
def shares_uri_for(target)
|
||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
||||
|
||||
target.account.numeric_ap_id? ? numeric_account_status_shares_url(target.account.id, target) : account_status_shares_url(target.account, target)
|
||||
target.account.numeric_ap_id? ? numeric_status_shares_url(target) : account_status_shares_url(target.account, target)
|
||||
end
|
||||
|
||||
def following_uri_for(target, ...)
|
||||
|
|
|
@ -95,17 +95,6 @@ Rails.application.routes.draw do
|
|||
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
|
||||
|
||||
concern :account_resources do
|
||||
resources :statuses, only: [:show] do
|
||||
member do
|
||||
get :activity
|
||||
get :embed
|
||||
end
|
||||
|
||||
resources :replies, only: [:index], module: :activitypub
|
||||
resources :likes, only: [:index], module: :activitypub
|
||||
resources :shares, only: [:index], module: :activitypub
|
||||
end
|
||||
|
||||
resources :followers, only: [:index], controller: :follower_accounts
|
||||
resources :following, only: [:index], controller: :following_accounts
|
||||
|
||||
|
@ -117,9 +106,31 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :accounts, path: 'users', only: [:show], param: :username, concerns: :account_resources
|
||||
resources :accounts, path: 'users', only: [:show], param: :username, concerns: :account_resources do
|
||||
resources :statuses, only: [:show] do
|
||||
member do
|
||||
get :activity
|
||||
get :embed
|
||||
end
|
||||
|
||||
resources :replies, only: [:index], module: :activitypub
|
||||
resources :likes, only: [:index], module: :activitypub
|
||||
resources :shares, only: [:index], module: :activitypub
|
||||
end
|
||||
end
|
||||
|
||||
resources :accounts, path: 'u', only: [:show], param: :id, as: :numeric_account, concerns: :account_resources
|
||||
|
||||
resources :statuses, path: 's', only: [:show], as: :numeric_status do
|
||||
member do
|
||||
get :activity
|
||||
end
|
||||
|
||||
resources :replies, only: [:index], module: :activitypub
|
||||
resources :likes, only: [:index], module: :activitypub
|
||||
resources :shares, only: [:index], module: :activitypub
|
||||
end
|
||||
|
||||
resource :inbox, only: [:create], module: :activitypub
|
||||
|
||||
constraints(encoded_path: /%40.*/) do
|
||||
|
|
Loading…
Reference in a new issue