diff --git a/lib/EntityManager.ts b/lib/EntityManager.ts index bc45e176..8c2ef4ad 100644 --- a/lib/EntityManager.ts +++ b/lib/EntityManager.ts @@ -266,10 +266,11 @@ export class EntityManager extends Lockable { if (this.connectData.user) { this._updateUser(this.connectData.user, true); } + } - if (this.bloomFilterRefresh > 0 && this.connectData.bloomFilter && atob && !isNode) { - this._updateBloomFilter(this.connectData.bloomFilter); - } + const bloomFilter = this.entityManagerFactory.connectData?.bloomFilter; + if (this.bloomFilterRefresh > 0 && bloomFilter && atob && !isNode) { + this._updateBloomFilter(bloomFilter); } } @@ -1126,6 +1127,9 @@ export class EntityManager extends Lockable { metadata.type.fromJsonValue(metadata, obj, device, { persisting: true }); this.deviceMe = device; + if (this.connectData) { + this.connectData.device = obj; + } return device; } diff --git a/spec/pushnotification.spec.js b/spec/pushnotification.spec.js index 9d371c10..8aaf6619 100644 --- a/spec/pushnotification.spec.js +++ b/spec/pushnotification.spec.js @@ -1,5 +1,3 @@ -'use strict'; - if (typeof module !== 'undefined') { require('./node'); } @@ -8,7 +6,7 @@ describe('Test Push Notifications', function () { var emf, db, lock; var TEST_GCM_DEVICE = 'APA91bFBRJGMI2OkQxhV3peP4ncZOIxGJBJ8s0tkKyWvzQErpZmuSzMzm6ugz3rOauMQ1CRui0bBsEQvuN0W8X1wTP547C6MSNcErnNYXyvc1F5eKZCs-GAtE_NcESolea2AM6_cRe9R'; - var TEST_GCM_APIKEY = 'AIzaSyAQvWS3mtqnTfLAA3LjepyQRrqDisVRnE0'; + var TEST_GCM_APIKEY = 'AAAAGvyekVM:APA91bHPRl-MulY1xAoH2LlGpvvUezPc_unKxfooN7G6rAVyKRINhoriPKrHUd5g5fdSyL3xl3B4NteDFMYXe589-UOtx0TXudwWjtG3eNUEhNXdsftC6BmLJEzxiiywSUzsa8Stogw8'; before(function () { this.timeout(40000); @@ -26,7 +24,8 @@ describe('Test Push Notifications', function () { lock = new db.Lock({ id: 'push' }); return createLock(); }).then(function () { - var msg = new DB.message.GCMAKey(TEST_GCM_APIKEY); + var msg = new DB.message.GCMAKey(); + msg.entity(TEST_GCM_APIKEY, 'text'); return emf.send(msg); }) .then(function () {