diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index a975522de53fe6802da5a60af4d603bf89f808fe..876ad83399384968a55443c01d11ce7a0c8b2ee6 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -200,10 +200,10 @@ app.views.Publisher = Backbone.View.extend({ // standalone means single-shot posting (until further notice) if( self.standalone ) self.setEnabled(false); }, - error: function() { + error: function(model, resp, options) { if( app.publisher ) app.publisher.trigger('publisher:error'); self.setInputEnabled(true); - Diaspora.page.flashMessages.render({ 'success':false, 'notice':Diaspora.I18n.t('failed_to_post_message') }); + Diaspora.page.flashMessages.render({ 'success':false, 'notice':resp.responseText }); self.setButtonsEnabled(true); self.setInputEnabled(true); } diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 76cfc55aaef1f114bb340d4b4479560721008332..75beea674a44c7c2a68942584f67aacbbe1e10ab 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -95,7 +95,7 @@ class StatusMessagesController < ApplicationController respond_to do |format| format.html { redirect_to :back } format.mobile { redirect_to stream_path } - format.json { render :nothing => true, :status => 403 } + format.json { render :text => @status_message.errors.messages[:text].join('. '), :status => 403 } end end end diff --git a/app/models/status_message.rb b/app/models/status_message.rb index 0695cdbdf64cd6fd35721691a3f47425b7d08284..e817b850766461483ffbba9860d6781da991b13d 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -10,7 +10,7 @@ class StatusMessage < Post acts_as_taggable_on :tags extract_tags_from :raw_message - validates_length_of :text, :maximum => 65535, :message => I18n.t('status_messages.too_long', :count => 65535) + validates_length_of :text, :maximum => 65535, :message => proc {|p, v| I18n.t('status_messages.too_long', :count => 65535, :current_length => v[:value].length)} # don't allow creation of empty status messages validate :presence_of_content, on: :create, if: proc { |sm| sm.author.local? } diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index fa2c84b8a5291861174183001e9233d1e6796d43..a6db18f67e050de20723cfe3a237b064a5ecbad1 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -1159,10 +1159,7 @@ en: no_message_to_display: "No message to display." destroy: failure: "Failed to delete post" - too_long: - zero: "please make your status messages less than %{count} characters" - one: "please make your status messages less than %{count} characters" - other: "please make your status messages less than %{count} characters" + too_long: "Please make your status message fewer than %{count} characters. Right now it is %{current_length} characters" stream_helper: show_comments: