mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-24 07:33:01 +01:00
Setup turbo_stream_actions before before_actions
Because apparently the error catching -> toast logic was not there yet and people might run into a 500 error redirect when pressing the button.
This commit is contained in:
parent
02db8e1a56
commit
4408de33cc
4 changed files with 9 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue