mirror of
https://github.com/mastodon/mastodon
synced 2025-01-10 11:53:03 +09: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
@ -47,9 +47,9 @@ class ActivityPub::TagManager
|
|||||||
end
|
end
|
||||||
when :note, :comment, :activity
|
when :note, :comment, :activity
|
||||||
if target.account.numeric_ap_id?
|
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
|
else
|
||||||
return activity_account_status_url(target.account, target) if target.reblog?
|
return activity_account_status_url(target.account, target) if target.reblog?
|
||||||
|
|
||||||
@ -81,25 +81,25 @@ class ActivityPub::TagManager
|
|||||||
def activity_uri_for(target)
|
def activity_uri_for(target)
|
||||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
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
|
end
|
||||||
|
|
||||||
def replies_uri_for(target, page_params = nil)
|
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?
|
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
|
end
|
||||||
|
|
||||||
def likes_uri_for(target)
|
def likes_uri_for(target)
|
||||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
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
|
end
|
||||||
|
|
||||||
def shares_uri_for(target)
|
def shares_uri_for(target)
|
||||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
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
|
end
|
||||||
|
|
||||||
def following_uri_for(target, ...)
|
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}" }
|
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
|
||||||
|
|
||||||
concern :account_resources do
|
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 :followers, only: [:index], controller: :follower_accounts
|
||||||
resources :following, only: [:index], controller: :following_accounts
|
resources :following, only: [:index], controller: :following_accounts
|
||||||
|
|
||||||
@ -117,9 +106,31 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
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 :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
|
resource :inbox, only: [:create], module: :activitypub
|
||||||
|
|
||||||
constraints(encoded_path: /%40.*/) do
|
constraints(encoded_path: /%40.*/) do
|
||||||
|
Loading…
Reference in New Issue
Block a user