Use full error messages for relations validation.

pull/1702/head
Richard 10 years ago
parent 520a8ce815
commit e50db0208a
  1. 9
      app/assets/javascripts/angular/helpers/components/api-helper.js
  2. 2
      lib/api/errors/validation.rb
  3. 2
      lib/api/v3/relations/relations_api.rb

@ -38,11 +38,12 @@ angular.module('openproject.workPackages.helpers')
},
getErrorMessage: function(error) {
var response = JSON.parse(error.responseText);
if(error.status == 422) {
return response.description + response.errors.map(function(error) {
return " \"" + error.key + "\"" + " " + error.messages[0];
}).join('. ');
var response = JSON.parse(error.responseText);
return response.errors.join('. ');
}
if(error.status == 500) {
return error.statusText;
}
},

@ -41,7 +41,7 @@ module API
end
def errors
@obj.errors.messages.map{ |m| { key: m[0], messages: m[1] }}
@obj.errors.full_messages
end
def to_json

@ -25,7 +25,7 @@ module API
relation.save!
representer.to_json
else
raise ::API::Errors::Validation.new(relation)
fail Errors::Validation.new(relation)
end
end

Loading…
Cancel
Save