Appease the reviewdog overlords

This commit is contained in:
Andreas Nedbal 2022-07-30 18:29:32 +02:00
parent 54e072c98c
commit 628959d754
1 changed files with 4 additions and 2 deletions

View File

@ -1,11 +1,13 @@
# frozen_string_literal: true
class AnswerController < ApplicationController class AnswerController < ApplicationController
def show def show
@answer = Answer.includes(comments: [:user, :smiles], question: [:user], smiles: [:user]).find(params[:id]) @answer = Answer.includes(comments: %i[user smiles], question: [:user], smiles: [:user]).find(params[:id])
@display_all = true @display_all = true
if user_signed_in? if user_signed_in?
notif = Notification.where(type: "Notification::QuestionAnswered", target_id: @answer.id, recipient_id: current_user.id, new: true).first notif = Notification.where(type: "Notification::QuestionAnswered", target_id: @answer.id, recipient_id: current_user.id, new: true).first
notif.update(new: false) unless notif.nil? notif&.update(new: false)
notif = Notification.where(type: "Notification::Commented", target_id: @answer.comments.pluck(:id), recipient_id: current_user.id, new: true) notif = Notification.where(type: "Notification::Commented", target_id: @answer.comments.pluck(:id), recipient_id: current_user.id, new: true)
notif.update_all(new: false) unless notif.empty? notif.update_all(new: false) unless notif.empty?
notif = Notification.where(type: "Notification::Smiled", target_id: @answer.smiles.pluck(:id), recipient_id: current_user.id, new: true) notif = Notification.where(type: "Notification::Smiled", target_id: @answer.smiles.pluck(:id), recipient_id: current_user.id, new: true)