user: only provide #followers and #followings as GET

This commit is contained in:
Georg Gadinger 2023-01-21 19:53:27 +01:00 committed by Andreas Nedbal
parent 989873ba62
commit b019f24aaa
3 changed files with 13 additions and 15 deletions

View File

@ -5,12 +5,11 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start#paginator
- if @type === :follower
= button_to show_user_followers_path(@user, last_id: @relationships_last_id), class: "btn btn-light" do
= t("voc.load")
- else
= button_to show_user_followings_path(@user, last_id: @relationships_last_id), class: "btn btn-light" do
= t("voc.load")
= button_to t("voc.load"), @type == :follower ? show_user_followers_path(@user) : show_user_followings_path(@user),
class: "btn btn-light",
method: :get,
params: { last_id: @relationships_last_id },
form: { data: { turbo_stream: true } }
- provide(:title, user_title(@user, 'friends and followers'))
- parent_layout 'user/profile'

View File

@ -5,9 +5,8 @@
= turbo_stream.update "paginator" do
- if @more_data_available
- if @type === :follower
= button_to show_user_followers_path(@user, last_id: @relationships_last_id), class: "btn btn-light" do
= t("voc.load")
- else
= button_to show_user_followings_path(@user, last_id: @relationships_last_id), class: "btn btn-light" do
= t("voc.load")
= button_to t("voc.load"), @type == :follower ? show_user_followers_path(@user) : show_user_followings_path(@user),
class: "btn btn-light",
method: :get,
params: { last_id: @relationships_last_id },
form: { data: { turbo_stream: true } }

View File

@ -155,9 +155,9 @@ Rails.application.routes.draw do
get "/@:username(/p/:page)", to: "user#show", as: :user, defaults: { page: 1 }
get "/@:username/a/:id", to: "answer#show", via: "get", as: :answer
match "/@:username/q/:id", to: "question#show", via: [:get, :post], as: :question
match "/@:username/followers(/p/:page)", to: "user#followers", via: [:get, :post], as: :show_user_followers, defaults: { page: 1 }
match "/@:username/followings(/p/:page)", to: "user#followings", via: [:get, :post], as: :show_user_followings, defaults: { page: 1 }
match "/@:username/friends(/p/:page)", to: redirect("/@%{username}/followings/p/%{page}"), via: [:get, :post], defaults: { page: 1 }
get "/@:username/followers(/p/:page)", to: "user#followers", as: :show_user_followers, defaults: { page: 1 }
get "/@:username/followings(/p/:page)", to: "user#followings", as: :show_user_followings, defaults: { page: 1 }
get "/@:username/friends(/p/:page)", to: redirect("/@%{username}/followings/p/%{page}"), defaults: { page: 1 }
match "/@:username/questions(/p/:page)", to: "user#questions", via: [:get, :post], as: :show_user_questions, defaults: { page: 1 }
get "/:username(/p/:page)", to: "user#show", as: :user_alt, defaults: { page: 1 }
get "/:username/a/:id", to: "answer#show", as: :answer_alt