Add translations for inbox ajax controller

This commit is contained in:
Andreas Nedbal 2022-07-06 10:29:05 +02:00 committed by Karina Kwiatek
parent 15946740eb
commit 1c31ff41db
3 changed files with 20 additions and 17 deletions

View File

@ -2,7 +2,7 @@ class Ajax::InboxController < AjaxController
def create def create
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
@ -14,7 +14,7 @@ class Ajax::InboxController < AjaxController
inbox = Inbox.create!(user: current_user, question_id: question.id, new: true) inbox = Inbox.create!(user: current_user, question_id: question.id, new: true)
@response[:status] = :okay @response[:status] = :okay
@response[:message] = I18n.t('messages.inbox.create.okay') @response[:message] = t(".success")
@response[:success] = true @response[:success] = true
@response[:render] = render_to_string(partial: 'inbox/entry', locals: { i: inbox }) @response[:render] = render_to_string(partial: 'inbox/entry', locals: { i: inbox })
inbox.update(new: false) inbox.update(new: false)
@ -27,7 +27,7 @@ class Ajax::InboxController < AjaxController
unless current_user == inbox.user unless current_user == inbox.user
@response[:status] = :fail @response[:status] = :fail
@response[:message] = I18n.t('messages.inbox.remove.fail') @response[:message] = t(".error")
return return
end end
@ -36,12 +36,12 @@ class Ajax::InboxController < AjaxController
rescue => e rescue => e
Sentry.capture_exception(e) Sentry.capture_exception(e)
@response[:status] = :err @response[:status] = :err
@response[:message] = I18n.t('messages.error') @response[:message] = t("errors.base")
return return
end end
@response[:status] = :okay @response[:status] = :okay
@response[:message] = I18n.t('messages.inbox.remove.okay') @response[:message] = t(".success")
@response[:success] = true @response[:success] = true
end end
@ -53,12 +53,12 @@ class Ajax::InboxController < AjaxController
rescue => e rescue => e
Sentry.capture_exception(e) Sentry.capture_exception(e)
@response[:status] = :err @response[:status] = :err
@response[:message] = I18n.t('messages.error') @response[:message] = t("errors.base")
return return
end end
@response[:status] = :okay @response[:status] = :okay
@response[:message] = I18n.t('messages.inbox.remove_all.okay') @response[:message] = t(".success")
@response[:success] = true @response[:success] = true
end end
@ -71,12 +71,12 @@ class Ajax::InboxController < AjaxController
rescue => e rescue => e
Sentry.capture_exception(e) Sentry.capture_exception(e)
@response[:status] = :err @response[:status] = :err
@response[:message] = I18n.t('messages.error') @response[:message] = t("errors.base")
return return
end end
@response[:status] = :okay @response[:status] = :okay
@response[:message] = I18n.t('messages.inbox.remove_all.okay') @response[:message] = t(".success")
@response[:success] = true @response[:success] = true
end end
end end

View File

@ -13,6 +13,17 @@ en:
destroy: destroy:
nopriv: "Can't delete other people's comments." nopriv: "Can't delete other people's comments."
success: "Successfully deleted comment." success: "Successfully deleted comment."
inbox:
create:
noauth: :messages.noauth
success: "Successfully added new question."
remove:
success: "Successfully deleted question."
error: "Question is not in your inbox."
remove_all:
success: "Successfully deleted questions."
remove_all_author:
success: :ajax.inbox.remove_all.success
mute_rule: mute_rule:
nopriv: "Can't edit other people's rules" nopriv: "Can't edit other people's rules"
create: create:

View File

@ -79,14 +79,6 @@ en:
notfound: "List not found." notfound: "List not found."
add: "Successfully added user to list." add: "Successfully added user to list."
remove: "Successfully removed user from list." remove: "Successfully removed user from list."
inbox:
create:
okay: "Successfully added new question."
remove:
fail: "question not in your inbox"
okay: "Successfully deleted question."
remove_all:
okay: "Successfully deleted questions."
moderation: moderation:
vote: vote:
fail: "You have already voted on this report." fail: "You have already voted on this report."