Check subscription in `answer/show`

This commit is contained in:
Karina Kwiatek 2023-02-17 00:45:40 +01:00
parent 7aed99d187
commit d7997db492
2 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ class AnswerController < ApplicationController
def show
@answer = Answer.includes(comments: %i[user smiles], question: [:user], smiles: [:user]).find(params[:id])
@subscribed = Subscription.where(user: current_user, answer: @answer).pluck(:id)
@display_all = true
if user_signed_in?

View File

@ -1,4 +1,4 @@
- provide(:title, answer_title(@answer))
- provide(:og, answer_opengraph(@answer))
.container-lg.container--main
= render 'answerbox', a: @answer, display_all: @display_all
= render 'answerbox', a: @answer, display_all: @display_all, subscribed_answer_ids: @subscribed