Thingy add/edit via AJAX returned nothing useful, and lied about error status. Fixes bug #11781.
This commit is contained in:
parent
04c49fb48e
commit
05c287cfc7
3 changed files with 30 additions and 5 deletions
|
|
@ -2645,9 +2645,10 @@ sub www_editThingDataSaveViaAjax {
|
|||
}
|
||||
|
||||
my $thingProperties = $self->getThing($thingId);
|
||||
use Data::Dumper;
|
||||
warn $thingId;
|
||||
warn Dumper $thingProperties;
|
||||
if ($thingProperties->{thingId}){
|
||||
my ($privilegedGroup,$workflowId);
|
||||
|
||||
return $session->privilege->insufficient() unless $self->canEditThingData($thingId, $thingDataId
|
||||
,$thingProperties);
|
||||
|
||||
|
|
@ -2658,12 +2659,15 @@ sub www_editThingDataSaveViaAjax {
|
|||
|
||||
my ($newThingDataId,$errors) = $self->editThingDataSave($thingId,$thingDataId);
|
||||
|
||||
if ($errors){
|
||||
$session->http->setStatus("400", "Bad Request");
|
||||
if (@{ $errors }) {
|
||||
$session->http->setStatus("400", "Bad Request");
|
||||
return JSON->new->encode($errors);
|
||||
}
|
||||
$session->http->setStatus("200");
|
||||
return '{}';
|
||||
}
|
||||
else {
|
||||
warn "thingId not found in thingProperties\n";
|
||||
$session->http->setStatus("404", "Not Found");
|
||||
return JSON->new->encode({message => "The thingId you requested can not be found."});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue