1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Bug fixes push notifications

This commit is contained in:
David Bomba 2016-03-03 11:24:13 +11:00
parent cc03b4456c
commit 28cd3e01a7
2 changed files with 10 additions and 9 deletions

View File

@ -163,24 +163,25 @@ class AccountApiController extends BaseAPIController
$devices = json_decode($account->devices, TRUE);
if(count($devices)<1)
return $this->errorResponse(['message'=>'no devices exist'], 400);
return $this->errorResponse(['message'=>'No registered devices.'], 400);
for($x=0; $x<count($devices); $x++)
{
if($devices[$x]['email'] == Auth::user()->username)
{
unset($devices[$x]);
$newDevice = [
'token' => $request->token,
'email' => $request->email,
'device' => $request->device,
'token' => $devices[$x]['token'],
'email' => $devices[$x]['email'],
'device' => $devices[$x]['device'],
'notify_sent' => $request->notify_sent,
'notify_viewed' => $request->notify_viewed,
'notify_approved' => $request->notify_approved,
'notify_paid' => $request->notify_paid,
];
unset($devices[$x]);
$devices[] = $newDevice;
$account->devices = json_encode($devices);
$account->save();

8
composer.lock generated
View File

@ -123,12 +123,12 @@
"source": {
"type": "git",
"url": "https://github.com/formers/former.git",
"reference": "795f7b9b200a4ff4a33b37a96eaaab0229e36325"
"reference": "e196c4336db77be97131f6a3b3c3b69b3a22b683"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/formers/former/zipball/795f7b9b200a4ff4a33b37a96eaaab0229e36325",
"reference": "795f7b9b200a4ff4a33b37a96eaaab0229e36325",
"url": "https://api.github.com/repos/formers/former/zipball/e196c4336db77be97131f6a3b3c3b69b3a22b683",
"reference": "e196c4336db77be97131f6a3b3c3b69b3a22b683",
"shasum": ""
},
"require": {
@ -174,7 +174,7 @@
"foundation",
"laravel"
],
"time": "2015-11-05 15:53:52"
"time": "2016-03-02 17:21:21"
},
{
"name": "anahkiasen/html-object",