From 2f82e3be317460f764367dc3b73daa4f3709f47e Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Wed, 18 Jan 2023 08:11:00 +0100 Subject: [PATCH] inbox: only provide #show as GET --- app/views/inbox/show.html.haml | 3 +-- app/views/inbox/show.turbo_stream.haml | 3 +-- config/routes.rb | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/inbox/show.html.haml b/app/views/inbox/show.html.haml index f829ea7e..8af73570 100644 --- a/app/views/inbox/show.html.haml +++ b/app/views/inbox/show.html.haml @@ -7,5 +7,4 @@ - if @more_data_available .d-flex.justify-content-center#paginator - = button_to inbox_path(last_id: @inbox_last_id), class: "btn btn-light" do - = t("voc.load") + = button_to t("voc.load"), inbox_path, class: "btn btn-light", method: :get, params: { last_id: @inbox_last_id }, form: { data: { "turbo-stream" => true } } diff --git a/app/views/inbox/show.turbo_stream.haml b/app/views/inbox/show.turbo_stream.haml index 8dd7cd2e..e2e6b160 100644 --- a/app/views/inbox/show.turbo_stream.haml +++ b/app/views/inbox/show.turbo_stream.haml @@ -4,5 +4,4 @@ = turbo_stream.update "paginator" do - if @more_data_available - = button_to t("voc.load"), inbox_path(last_id: @inbox_last_id), class: "btn btn-light" - + = button_to t("voc.load"), inbox_path, class: "btn btn-light", method: :get, params: { last_id: @inbox_last_id }, form: { data: { "turbo-stream" => true } } diff --git a/config/routes.rb b/config/routes.rb index 90d380ca..c68933ef 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -149,7 +149,7 @@ Rails.application.routes.draw do match "/notifications(/:type)", to: "notifications#index", via: [:get, :post], as: :notifications, defaults: { type: "new" } post "/inbox/create", to: "inbox#create", as: :inbox_create - match "/inbox(/:author)", via: [:get, :post], to: "inbox#show", as: :inbox + get "/inbox", to: "inbox#show", as: :inbox match "/user/:username(/p/:page)", to: "user#show", via: [:get, :post], defaults: { page: 1 } match "/@:username(/p/:page)", to: "user#show", via: [:get, :post], as: :user, defaults: { page: 1 }