Move comment, like and reshare creation error translations

closes #7202
This commit is contained in:
Steffen van Bergerem 2016-11-19 01:36:36 +01:00 committed by Benjamin Neff
parent f999624967
commit 0051d6a0b8
8 changed files with 15 additions and 9 deletions

View file

@ -8,6 +8,7 @@
* Use typeahead.js from rails-assets.org [#7192](https://github.com/diaspora/diaspora/pull/7192)
* Refactor ShareVisibilitesController to use PostService [#7196](https://github.com/diaspora/diaspora/pull/7196)
* Unify desktop and mobile head elements [#7194](https://github.com/diaspora/diaspora/pull/7194)
* Refactor flash messages on ajax errors for comments, likes, reshares and aspect memberships [#7202](https://github.com/diaspora/diaspora/pull/7202)
## Bug fixes
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)

View file

@ -15,14 +15,14 @@ class CommentsController < ApplicationController
begin
comment = comment_service.create(params[:post_id], params[:text])
rescue ActiveRecord::RecordNotFound
render text: I18n.t("javascripts.failed_to_comment"), status: 404
render text: I18n.t("comments.create.error"), status: 404
return
end
if comment
respond_create_success(comment)
else
render text: I18n.t("javascripts.failed_to_comment"), status: 422
render text: I18n.t("comments.create.error"), status: 422
end
end

View file

@ -26,7 +26,7 @@ class LikesController < ApplicationController
format.json { render :json => @like.as_api_response(:backbone), :status => 201 }
end
else
render text: I18n.t("javascripts.failed_to_like"), status: 422
render text: I18n.t("likes.create.error"), status: 422
end
end

View file

@ -14,7 +14,7 @@ class ResharesController < ApplicationController
current_user.dispatch_post(@reshare)
render :json => ExtremePostPresenter.new(@reshare, current_user), :status => 201
else
render text: I18n.t("javascripts.failed_to_reshare"), status: 422
render text: I18n.t("reshares.create.error"), status: 422
end
end

View file

@ -240,6 +240,8 @@ en:
explanation: "Post to diaspora* from anywhere by bookmarking this link => %{link}."
comments:
create:
error: "Failed to comment."
new_comment:
comment: "Comment"
commenting: "Commenting..."
@ -591,6 +593,10 @@ en:
source_package: "Download the source code package"
be_excellent: "Be excellent to each other! ♥"
likes:
create:
error: "Failed to like."
notifications:
started_sharing:
zero: "%{actors} started sharing with you."
@ -991,6 +997,8 @@ en:
invalid_invite: "The invite link you provided is no longer valid!"
reshares:
create:
error: "Failed to reshare."
reshare:
reshared_via: "Reshared via"
reshare_confirmation: "Reshare %{author}s post?"

View file

@ -189,9 +189,6 @@ en:
one: "In <%= count %> aspect"
other: "In <%= count %> aspects"
show_more: "Show more"
failed_to_like: "Failed to like. Maybe the author is ignoring you?"
failed_to_reshare: "Failed to reshare!"
failed_to_comment: "Failed to comment. Maybe the author is ignoring you?"
failed_to_post_message: "Failed to post message!"
failed_to_remove: "Failed to remove the entry!"
comments:

View file

@ -67,7 +67,7 @@ describe CommentsController, :type => :controller do
expect(alice).not_to receive(:comment)
post :create, comment_hash
expect(response.code).to eq("404")
expect(response.body).to eq(I18n.t("javascripts.failed_to_comment"))
expect(response.body).to eq(I18n.t("comments.create.error"))
end
end

View file

@ -46,7 +46,7 @@ describe ResharesController, :type => :controller do
it 'doesn\'t allow the user to reshare the post again' do
post_request!
expect(response.code).to eq('422')
expect(response.body).to eq(I18n.t("javascripts.failed_to_reshare"))
expect(response.body).to eq(I18n.t("reshares.create.error"))
end
end