Check subscription in `answer/show`
This commit is contained in:
parent
7aed99d187
commit
d7997db492
|
@ -9,6 +9,7 @@ class AnswerController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@answer = Answer.includes(comments: %i[user smiles], question: [:user], smiles: [:user]).find(params[:id])
|
@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
|
@display_all = true
|
||||||
|
|
||||||
if user_signed_in?
|
if user_signed_in?
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- provide(:title, answer_title(@answer))
|
- provide(:title, answer_title(@answer))
|
||||||
- provide(:og, answer_opengraph(@answer))
|
- provide(:og, answer_opengraph(@answer))
|
||||||
.container-lg.container--main
|
.container-lg.container--main
|
||||||
= render 'answerbox', a: @answer, display_all: @display_all
|
= render 'answerbox', a: @answer, display_all: @display_all, subscribed_answer_ids: @subscribed
|
||||||
|
|
Loading…
Reference in New Issue