core: properly clear cache in clearSession

Bump to latest backbone.browserStorage which adds the `clear` method
This commit is contained in:
JC Brand 2019-12-11 15:11:22 +01:00
parent c379807d4c
commit 0f63c84d5b
3 changed files with 33 additions and 34 deletions

49
package-lock.json generated
View File

@ -2994,8 +2994,8 @@
} }
}, },
"backbone.browserStorage": { "backbone.browserStorage": {
"version": "github:conversejs/backbone.browserStorage#2d0ceaa2f38eedc60122bb0aa23c826dc37a9194", "version": "github:conversejs/backbone.browserStorage#674ba3aa0e4d0f0b0dcac48fcc7dea531012828f",
"from": "github:conversejs/backbone.browserStorage#2d0ceaa2f38eedc60122bb0aa23c826dc37a9194" "from": "github:conversejs/backbone.browserStorage#674ba3aa0e4d0f0b0dcac48fcc7dea531012828f"
}, },
"backbone.nativeview": { "backbone.nativeview": {
"version": "github:conversejs/Backbone.NativeView#5997c8197ca594e6b8469447f28310c78bd1d95e", "version": "github:conversejs/Backbone.NativeView#5997c8197ca594e6b8469447f28310c78bd1d95e",
@ -14041,10 +14041,13 @@
} }
}, },
"npm-bundled": { "npm-bundled": {
"version": "1.0.6", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz",
"integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==",
"dev": true "dev": true,
"requires": {
"npm-normalize-package-bin": "^1.0.1"
}
}, },
"npm-lifecycle": { "npm-lifecycle": {
"version": "3.1.4", "version": "3.1.4",
@ -14079,6 +14082,12 @@
} }
} }
}, },
"npm-normalize-package-bin": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz",
"integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==",
"dev": true
},
"npm-package-arg": { "npm-package-arg": {
"version": "6.1.1", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz",
@ -14100,9 +14109,9 @@
} }
}, },
"npm-packlist": { "npm-packlist": {
"version": "1.4.6", "version": "1.4.7",
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.6.tgz", "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.7.tgz",
"integrity": "sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg==", "integrity": "sha512-vAj7dIkp5NhieaGZxBJB8fF4R0078rqsmhJcAfXZ6O7JJhjhPK96n5Ry1oZcfLXgfun0GWTZPOxaEyqv8GBykQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"ignore-walk": "^3.0.1", "ignore-walk": "^3.0.1",
@ -15370,24 +15379,16 @@
} }
}, },
"read-package-json": { "read-package-json": {
"version": "2.1.0", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.0.tgz", "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.1.tgz",
"integrity": "sha512-KLhu8M1ZZNkMcrq1+0UJbR8Dii8KZUqB0Sha4mOx/bknfKI/fyrQVrG/YIt2UOtG667sD8+ee4EXMM91W9dC+A==", "integrity": "sha512-dAiqGtVc/q5doFz6096CcnXhpYk0ZN8dEKVkGLU0CsASt8SrgF6SF7OTKAYubfvFhWaqofl+Y8HK19GR8jwW+A==",
"dev": true, "dev": true,
"requires": { "requires": {
"glob": "^7.1.1", "glob": "^7.1.1",
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.2",
"json-parse-better-errors": "^1.0.1", "json-parse-better-errors": "^1.0.1",
"normalize-package-data": "^2.0.0", "normalize-package-data": "^2.0.0",
"slash": "^1.0.0" "npm-normalize-package-bin": "^1.0.0"
},
"dependencies": {
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
"dev": true
}
} }
}, },
"read-package-tree": { "read-package-tree": {
@ -17610,9 +17611,9 @@
} }
}, },
"uglify-js": { "uglify-js": {
"version": "3.7.1", "version": "3.7.2",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.1.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz",
"integrity": "sha512-pnOF7jY82wdIhATVn87uUY/FHU+MDUdPLkmGFvGoclQmeu229eTkbG5gjGGBi3R7UuYYSEeYXY/TTY5j2aym2g==", "integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {

View File

@ -120,17 +120,15 @@ _converse.Collection = Backbone.Collection.extend({
async clearSession (options={}) { async clearSession (options={}) {
await Promise.all(Array.from(this.models).map(m => { await Promise.all(Array.from(this.models).map(m => {
return new Promise( return new Promise(
success => m.destroy( resolve => {
Object.assign(options, { m.destroy(Object.assign(options, {
success, 'success': resolve,
'error': (m, e) => { 'error': (m, e) => { log.error(e); resolve() }
log.error(e); }));
success() }
}
})
)
); );
})); }));
await this.browserStorage.clear();
this.reset(); this.reset();
} }
}); });

View File

@ -23,7 +23,7 @@
"gitHead": "9641dcdc820e029b05930479c242d2b707bbe8e2", "gitHead": "9641dcdc820e029b05930479c242d2b707bbe8e2",
"devDependencies": { "devDependencies": {
"backbone": "1.4", "backbone": "1.4",
"backbone.browserStorage": "conversejs/backbone.browserStorage#2d0ceaa2f38eedc60122bb0aa23c826dc37a9194", "backbone.browserStorage": "conversejs/backbone.browserStorage#674ba3aa0e4d0f0b0dcac48fcc7dea531012828f",
"filesize": "^4.1.2", "filesize": "^4.1.2",
"jed": "1.1.1", "jed": "1.1.1",
"localforage": "^1.7.3", "localforage": "^1.7.3",