From 52416ebde4309d70fcf533db26f8d61707aba63e Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Wed, 19 Mar 2014 18:06:34 +0900 Subject: [PATCH] Remove device owner if device is not present. --- lib/roles/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/roles/app.js b/lib/roles/app.js index d168d0fb..4b650816 100644 --- a/lib/roles/app.js +++ b/lib/roles/app.js @@ -121,6 +121,9 @@ module.exports = function(options) { list.forEach(function(device) { datautil.applyData(device) datautil.applyOwner(device, req.user) + if (!device.present) { + device.owner = null + } }) res.json({ success: true @@ -144,6 +147,9 @@ module.exports = function(options) { list.forEach(function(device) { datautil.applyData(device) datautil.applyOwner(device, req.user) + if (!device.present) { + device.owner = null + } }) res.json({ success: true @@ -165,6 +171,9 @@ module.exports = function(options) { if (device) { datautil.applyData(device) datautil.applyOwner(device, req.user) + if (!device.present) { + device.owner = null + } res.json({ success: true , device: device