From 7dbb44ae9d34ac87e9171a88b6a7046f8d245c53 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 12 Dec 2018 15:47:52 +0100 Subject: [PATCH] user wasn't updated completly via update command --- frontend-js/src/main/js/map/data/User.js | 12 ++++++++++-- frontend-js/src/test/js/map/data/User-test.js | 13 ++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/frontend-js/src/main/js/map/data/User.js b/frontend-js/src/main/js/map/data/User.js index 38df586773..37496daa81 100644 --- a/frontend-js/src/main/js/map/data/User.js +++ b/frontend-js/src/main/js/map/data/User.js @@ -351,6 +351,10 @@ User.prototype.update = function (user) { self.setMinColor(user.getMinColor()); self.setMaxColor(user.getMaxColor()); self.setSimpleColor(user.getSimpleColor()); + self.setNeutralColor(user.getNeutralColor()); + self.setTermsOfUseConsent(user.isTermsOfUseConsent()); + self.setLdapAccountAvailable(user.isLdapAccountAvailable()); + self.setConnectedToLdap(user.isConnectedToLdap()); return self.callListeners("onreload"); }; @@ -376,7 +380,9 @@ User.prototype.isTermsOfUseConsent = function () { * @param {boolean} ldapAccountAvailable */ User.prototype.setLdapAccountAvailable = function (ldapAccountAvailable) { - this._ldapAccountAvailable = ldapAccountAvailable; + if (ldapAccountAvailable !== undefined) { + this._ldapAccountAvailable = ldapAccountAvailable; + } }; /** @@ -392,7 +398,9 @@ User.prototype.isLdapAccountAvailable = function () { * @param {boolean} connectedToLdap */ User.prototype.setConnectedToLdap = function (connectedToLdap) { - this._connectedToLdap = connectedToLdap; + if (connectedToLdap !== undefined) { + this._connectedToLdap = connectedToLdap; + } }; /** diff --git a/frontend-js/src/test/js/map/data/User-test.js b/frontend-js/src/test/js/map/data/User-test.js index 6b43246429..b2870a33ac 100644 --- a/frontend-js/src/test/js/map/data/User-test.js +++ b/frontend-js/src/test/js/map/data/User-test.js @@ -10,7 +10,7 @@ var logger = require('../../logger'); var chai = require('chai'); var assert = chai.assert; -describe('Project', function () { +describe('User', function () { describe("constructor", function () { it("empty data", function () { var user = new User({}); @@ -20,6 +20,17 @@ describe('Project', function () { }); }); + describe("update", function () { + it("ldap account available", function () { + var user = new User({}); + assert.ok(user); + var user2 = new User({ldapAccountAvailable:true}); + user.update(user2); + assert.ok(user.isLdapAccountAvailable()); + }); + }); + + describe("setPrivilege", function () { it("non existing data", function () { var user = new User({}); -- GitLab