2   class MutesController < ApplicationController
 
   5     before_action :authorize_web
 
   6     before_action :set_locale
 
   8     authorize_resource :message
 
  10     before_action :check_database_readable
 
  11     before_action :check_database_writable
 
  13     # Moves message into Inbox by unsetting the muted-flag
 
  15       message = current_user.muted_messages.find(params[:message_id])
 
  18         flash[:notice] = t(".notice")
 
  20         flash[:error] = t(".error")
 
  23       if current_user.muted_messages.none?
 
  24         redirect_to messages_inbox_path
 
  26         redirect_to messages_muted_inbox_path
 
  28     rescue ActiveRecord::RecordNotFound
 
  29       @title = t "messages.no_such_message.title"
 
  30       render :template => "messages/no_such_message", :status => :not_found