mirror of
https://ghfast.top/https://github.com/discourse/discourse-follow.git
synced 2026-07-15 11:36:38 +08:00
Why manually require files when we can autoload? Also update `discourse-rubocop` and resolve new lint violations.
56 lines
1.4 KiB
Ruby
56 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
Follow::Engine.routes.draw do
|
|
put ":username" => "follow#follow",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
format: /(json|html)/,
|
|
},
|
|
:defaults => {
|
|
format: :json,
|
|
}
|
|
|
|
delete ":username" => "follow#unfollow",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
format: /(json|html)/,
|
|
},
|
|
:defaults => {
|
|
format: :json,
|
|
}
|
|
|
|
get "posts/:username" => "follow#posts",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
format: /(json|html)/,
|
|
},
|
|
:defaults => {
|
|
format: :json,
|
|
}
|
|
end
|
|
|
|
Discourse::Application.routes.draw do
|
|
mount ::Follow::Engine, at: "follow"
|
|
|
|
%w[users u].each_with_index do |root_path, index|
|
|
get "#{root_path}/:username/follow" => "follow/follow#index",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
}
|
|
|
|
get "#{root_path}/:username/follow/feed" => "follow/follow#index",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
}
|
|
|
|
get "#{root_path}/:username/follow/following" => "follow/follow#list_following",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
}
|
|
|
|
get "#{root_path}/:username/follow/followers" => "follow/follow#list_followers",
|
|
:constraints => {
|
|
username: RouteFormat.username,
|
|
}
|
|
end
|
|
end
|