Fix restriction without restricted data cache

This commit is contained in:
FinnStutzenstein 2019-06-25 16:56:06 +02:00
parent ae618fce20
commit b7e98a565a
2 changed files with 9 additions and 2 deletions

View File

@ -45,7 +45,6 @@ export class RoutingStateService {
)
.subscribe((event: any[]) => {
this._previousUrl = event[0].urlAfterRedirects;
console.log('prev URL: ', this._previousUrl);
});
}
}

View File

@ -396,7 +396,15 @@ class ElementCache:
for collection_string, full_data in changed_elements.items():
restricter = self.cachables[collection_string].restrict_elements
elements = await restricter(user_id, full_data)
restricted_data[collection_string] = elements
# Add removed objects (through restricter) to deleted elements.
full_data_ids = set([data["id"] for data in full_data])
restricted_data_ids = set([data["id"] for data in elements])
for id in full_data_ids - restricted_data_ids:
deleted_elements.append(get_element_id(collection_string, id))
if elements:
restricted_data[collection_string] = elements
return restricted_data, deleted_elements
lowest_change_id = await self.get_lowest_change_id()