pupilfirst/pupilfirst

View on GitHub
app/controllers/notifications_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
42%
class NotificationsController < ApplicationController
  before_action :authenticate_user!

  # GET /notifications/:id
  def show
    notification = authorize(current_user.notifications.find(params[:id]))
    notification.touch(:read_at) if notification.read_at.blank? # rubocop:disable Rails/SkipsModelValidations

    path = Notifications::ResolvePathService.new(notification).resolve
    redirect_to(path)
  end
end