1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

Add filter integration tests; more bug fixes.

This commit is contained in:
Kegan Dougal
2015-12-08 16:08:04 +00:00
parent 86a162c818
commit c65f32f6a6
3 changed files with 101 additions and 4 deletions

View File

@@ -17,6 +17,11 @@ module.exports.MatrixInMemoryStore = function MatrixInMemoryStore() {
// userId: User
};
this.syncToken = null;
this.filters = {
// userId: {
// filterId: Filter
// }
};
};
module.exports.MatrixInMemoryStore.prototype = {
@@ -116,6 +121,11 @@ module.exports.MatrixInMemoryStore.prototype = {
* @param {Filter} filter
*/
storeFilter: function(filter) {
if (!filter) { return; }
if (!this.filters[filter.userId]) {
this.filters[filter.userId] = {};
}
this.filters[filter.userId][filter.filterId] = filter;
},
/**
@@ -125,7 +135,10 @@ module.exports.MatrixInMemoryStore.prototype = {
* @return {?Filter} A filter or null.
*/
getFilter: function(userId, filterId) {
return null;
if (!this.filters[userId] || !this.filters[userId][filterId]) {
return null;
}
return this.filters[userId][filterId];
}
// TODO