1 # frozen_string_literal: true
 
   4   class ReadMarksController < ApplicationController
 
   7     before_action :authorize_web
 
   8     before_action :set_locale
 
  10     authorize_resource :message
 
  12     before_action :check_database_readable
 
  13     before_action :check_database_writable
 
  25     def mark(message_read)
 
  26       @message = current_user.messages.unscope(:where => :muted).find(params[:message_id])
 
  27       @message.message_read = message_read
 
  29         flash[:notice] = t ".notice"
 
  31           redirect_to messages_muted_inbox_path, :status => :see_other
 
  33           redirect_to messages_inbox_path, :status => :see_other
 
  36     rescue ActiveRecord::RecordNotFound
 
  37       @title = t "messages.no_such_message.title"
 
  38       render :template => "messages/no_such_message", :status => :not_found