2023-03-11 19:48:04 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CommentController < ApplicationController
|
|
|
|
def index
|
|
|
|
answer = Answer.find(params[:id])
|
2023-05-07 17:33:46 +02:00
|
|
|
@comments = Comment.where(answer:).includes([{ user: :profile }, :smiles])
|
2023-03-11 19:48:04 +01:00
|
|
|
|
2023-05-05 15:58:19 +02:00
|
|
|
render "index", locals: { a: answer }
|
2023-03-11 19:48:04 +01:00
|
|
|
end
|
2023-10-23 00:45:00 +02:00
|
|
|
|
|
|
|
def show_reactions
|
|
|
|
comment = Comment.find(params[:id])
|
2023-10-28 04:31:35 +02:00
|
|
|
@reactions = Reaction.where(parent_type: "Comment", parent: comment.id).includes([{ user: :profile }])
|
2023-10-23 00:45:00 +02:00
|
|
|
|
|
|
|
redirect_to answer_path(username: comment.answer.user.screen_name, id: comment.answer.id) unless turbo_frame_request?
|
|
|
|
end
|
2023-03-11 19:48:04 +01:00
|
|
|
end
|