diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 6bf4d79e3b..362df81108 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -248,7 +248,8 @@ "App locked": "Aplicación bloqueada por el usuario {{userId}}", "Email verify": "Correo de verificación", "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", - "Receipt's bank was not found": "No se encontró el banco del recibo", - "This receipt was not compensated": "Este recibo no ha sido compensado", - "Client's email was not found": "No se encontró el email del cliente" -} + "Receipt's bank was not found": "No se encontró el banco del recibo", + "This receipt was not compensated": "Este recibo no ha sido compensado", + "Client's email was not found": "No se encontró el email del cliente", + "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9" +} \ No newline at end of file diff --git a/modules/mdb/back/methods/mdbApp/lock.js b/modules/mdb/back/methods/mdbApp/lock.js index 6006d4fad0..98e61fb534 100644 --- a/modules/mdb/back/methods/mdbApp/lock.js +++ b/modules/mdb/back/methods/mdbApp/lock.js @@ -41,12 +41,13 @@ module.exports = Self => { } try { - const mdbApp = await models.MdbApp.findById(appName, null, myOptions); + const mdbApp = await models.MdbApp.findById(appName, {fields: ['app', 'locked', 'userFk']}, myOptions); - const message = $t('App locked', { - userId: mdbApp.userFk - }); - if (mdbApp.locked) throw new UserError(message); + if (mdbApp.locked) { + throw new UserError($t('App locked', { + userId: mdbApp.userFk + })); + } const updatedMdbApp = await mdbApp.updateAttributes({ userFk: userId, diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js index adb155c06b..5dfe5d3ef5 100644 --- a/modules/mdb/back/methods/mdbVersion/upload.js +++ b/modules/mdb/back/methods/mdbVersion/upload.js @@ -64,10 +64,12 @@ module.exports = Self => { let srcFile; try { const mdbApp = await models.MdbApp.findById(appName, null, myOptions); - const message = $t('App locked', { - userId: mdbApp.userFk - }); - if (mdbApp.locked && mdbApp.userFk != userId) throw new UserError(message); + + if (mdbApp.locked && mdbApp.userFk != userId) { + throw new UserError($t('App locked', { + userId: mdbApp.userFk + })); + } const tempContainer = await TempContainer.container('access'); const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);