diff --git a/app/controllers/answer_controller.rb b/app/controllers/answer_controller.rb index 0ff5ca86..54832482 100644 --- a/app/controllers/answer_controller.rb +++ b/app/controllers/answer_controller.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true class AnswerController < ApplicationController - before_action :authenticate_user!, only: %i[pin unpin] - before_action :not_readonly!, except: %i[show] - include TurboStreamable turbo_stream_actions :pin, :unpin + before_action :authenticate_user!, only: %i[pin unpin] + before_action :not_readonly!, except: %i[show] + def show @answer = Answer.for_user(current_user).includes(question: [:user], smiles: [:user]).find(params[:id]) @display_all = true diff --git a/app/controllers/reactions_controller.rb b/app/controllers/reactions_controller.rb index 26cc8c85..9a9a4063 100644 --- a/app/controllers/reactions_controller.rb +++ b/app/controllers/reactions_controller.rb @@ -3,11 +3,11 @@ class ReactionsController < ApplicationController include TurboStreamable + turbo_stream_actions :create, :destroy + before_action :authenticate_user!, only: %w[create destroy] before_action :not_readonly!, except: %i[index] - turbo_stream_actions :create, :destroy - def index answer = Answer.includes([smiles: { user: :profile }]).find(params[:id]) diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb index 58edd17f..3abcf8aa 100644 --- a/app/controllers/relationships_controller.rb +++ b/app/controllers/relationships_controller.rb @@ -3,11 +3,11 @@ class RelationshipsController < ApplicationController include TurboStreamable + turbo_stream_actions :create, :destroy + before_action :authenticate_user! before_action :not_readonly! - turbo_stream_actions :create, :destroy - def create params.require :screen_name diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index 1bb92e57..68fc83d7 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -3,11 +3,11 @@ class SubscriptionsController < ApplicationController include TurboStreamable + turbo_stream_actions :create, :destroy + before_action :authenticate_user! before_action :not_readonly! - turbo_stream_actions :create, :destroy - def create answer = Answer.find(params[:answer]) result = Subscription.subscribe(current_user, answer)