mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-01 03:19:09 +01:00
24 lines
813 B
Ruby
24 lines
813 B
Ruby
class AnswerController < ApplicationController
|
|
def show
|
|
@answer = Answer.find(params[:id])
|
|
@display_all = true
|
|
|
|
if user_signed_in?
|
|
notif = Notification.where(target_type: "Answer", target_id: @answer.id, recipient_id: current_user.id, new: true).first
|
|
unless notif.nil?
|
|
notif.new = false
|
|
notif.save
|
|
end
|
|
notif = Notification.where(target_type: "Comment", target_id: @answer.comments.pluck(:id), recipient_id: current_user.id, new: true).first
|
|
unless notif.nil?
|
|
notif.new = false
|
|
notif.save
|
|
end
|
|
notif = Notification.where(target_type: "Smile", target_id: @answer.smiles.pluck(:id), recipient_id: current_user.id, new: true).first
|
|
unless notif.nil?
|
|
notif.new = false
|
|
notif.save
|
|
end
|
|
end
|
|
end
|
|
end
|