1 class UserMutesController < ApplicationController
6 before_action :authorize_web
7 before_action :set_locale
11 before_action :lookup_user, :only => [:create, :destroy]
12 before_action :check_database_readable
13 before_action :check_database_writable, :only => [:create, :destroy]
16 @muted_users = current_user.muted_users
19 redirect_to edit_account_path unless @muted_users.any?
23 user_mute = current_user.mutes.build(:subject => @user)
26 flash[:notice] = t(".notice", :name => user_mute.subject.display_name)
28 flash[:error] = t(".error", :name => user_mute.subject.display_name, :full_message => user_mute.errors.full_messages.to_sentence.humanize)
31 redirect_back_or_to user_mutes_path(current_user)
35 user_mute = current_user.mutes.find_by!(:subject => @user)
38 flash[:notice] = t(".notice", :name => user_mute.subject.display_name)
40 flash[:error] = t(".error")
43 redirect_back_or_to user_mutes_path(current_user)