Add translations for mute rule controller actions
This commit is contained in:
parent
cc50219d05
commit
79dbf7d1c8
|
@ -4,14 +4,14 @@ class Ajax::MuteRuleController < AjaxController
|
||||||
|
|
||||||
unless user_signed_in?
|
unless user_signed_in?
|
||||||
@response[:status] = :noauth
|
@response[:status] = :noauth
|
||||||
@response[:message] = I18n.t('messages.noauth')
|
@response[:message] = t(".noauth")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
rule = MuteRule.create!(user: current_user, muted_phrase: params[:muted_phrase])
|
rule = MuteRule.create!(user: current_user, muted_phrase: params[:muted_phrase])
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
@response[:message] = "Rule added successfully."
|
@response[:message] = t(".success")
|
||||||
@response[:id] = rule.id
|
@response[:id] = rule.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class Ajax::MuteRuleController < AjaxController
|
||||||
|
|
||||||
unless user_signed_in?
|
unless user_signed_in?
|
||||||
@response[:status] = :noauth
|
@response[:status] = :noauth
|
||||||
@response[:message] = I18n.t('messages.noauth')
|
@response[:message] = t(".noauth")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class Ajax::MuteRuleController < AjaxController
|
||||||
|
|
||||||
if rule.user_id != current_user.id
|
if rule.user_id != current_user.id
|
||||||
@response[:status] = :nopriv
|
@response[:status] = :nopriv
|
||||||
@response[:message] = "Can't edit other people's rules"
|
@response[:message] = t(".nopriv")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class Ajax::MuteRuleController < AjaxController
|
||||||
rule.save!
|
rule.save!
|
||||||
|
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:message] = "Rule updated successfully."
|
@response[:message] = t(".success")
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class Ajax::MuteRuleController < AjaxController
|
||||||
|
|
||||||
unless user_signed_in?
|
unless user_signed_in?
|
||||||
@response[:status] = :noauth
|
@response[:status] = :noauth
|
||||||
@response[:message] = I18n.t('messages.noauth')
|
@response[:message] = t(".noauth")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ class Ajax::MuteRuleController < AjaxController
|
||||||
|
|
||||||
if rule.user_id != current_user.id
|
if rule.user_id != current_user.id
|
||||||
@response[:status] = :nopriv
|
@response[:status] = :nopriv
|
||||||
@response[:message] = "Can't edit other people's rules"
|
@response[:message] = t(".nopriv")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
rule.destroy!
|
rule.destroy!
|
||||||
|
|
||||||
@response[:status] = :okay
|
@response[:status] = :okay
|
||||||
@response[:message] = "Rule deleted successfully."
|
@response[:message] = t(".success")
|
||||||
@response[:success] = true
|
@response[:success] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,18 @@
|
||||||
en:
|
en:
|
||||||
|
ajax:
|
||||||
|
mute_rule:
|
||||||
|
nopriv: "Can't edit other people's rules"
|
||||||
|
create:
|
||||||
|
noauth: :messages.noauth
|
||||||
|
success: "Rule added successfully."
|
||||||
|
update:
|
||||||
|
noauth: :messages.noauth
|
||||||
|
nopriv: :ajax.mute_rule.nopriv
|
||||||
|
success: "Rule updated successfully."
|
||||||
|
destroy:
|
||||||
|
noauth: :messages.noauth
|
||||||
|
nopriv: :ajax.mute_rule.nopriv
|
||||||
|
success: "Rule deleted successfully."
|
||||||
announcement:
|
announcement:
|
||||||
create:
|
create:
|
||||||
success: "Announcement created successfully."
|
success: "Announcement created successfully."
|
||||||
|
|
Loading…
Reference in New Issue