mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-27 12:08:32 +03:00
Add filtering.filter_events function, with stub passes_filter function.
This commit is contained in:
parent
3773759c0f
commit
2a4fda7b88
1 changed files with 15 additions and 0 deletions
|
@ -34,6 +34,21 @@ class Filtering(object):
|
|||
# replace_user_filter at some point? There's no REST API specified for
|
||||
# them however
|
||||
|
||||
def passes_filter(self, filter_json, event):
|
||||
"""Check if the event passes through the filter.
|
||||
|
||||
Args:
|
||||
filter_json(dict): The filter specification
|
||||
event(Event): The event to check
|
||||
Returns:
|
||||
True if the event passes through the filter.
|
||||
"""
|
||||
return True
|
||||
|
||||
def filter_events(self, events, user, filter_id):
|
||||
filter_json = self.get_user_filter(user, filter_id)
|
||||
return [e for e in events if self.passes_filter(filter_json, e)]
|
||||
|
||||
def _check_valid_filter(self, user_filter):
|
||||
"""Check if the provided filter is valid.
|
||||
|
||||
|
|
Loading…
Reference in a new issue