mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Use 'in' to test if the key exists, remove unused _filters_for_user
This commit is contained in:
parent
c562f237f6
commit
e97f756a05
@ -114,21 +114,17 @@ class Filtering(object):
|
|||||||
if not isinstance(event_type, basestring):
|
if not isinstance(event_type, basestring):
|
||||||
raise SynapseError(400, "Event type should be a string")
|
raise SynapseError(400, "Event type should be a string")
|
||||||
|
|
||||||
try:
|
if "format" in definition:
|
||||||
event_format = definition["format"]
|
event_format = definition["format"]
|
||||||
if event_format not in ["federation", "events"]:
|
if event_format not in ["federation", "events"]:
|
||||||
raise SynapseError(400, "Invalid format: %s" % (event_format,))
|
raise SynapseError(400, "Invalid format: %s" % (event_format,))
|
||||||
except KeyError:
|
|
||||||
pass # format is optional
|
|
||||||
|
|
||||||
try:
|
if "select" in definition:
|
||||||
event_select_list = definition["select"]
|
event_select_list = definition["select"]
|
||||||
for select_key in event_select_list:
|
for select_key in event_select_list:
|
||||||
if select_key not in ["event_id", "origin_server_ts",
|
if select_key not in ["event_id", "origin_server_ts",
|
||||||
"thread_id", "content", "content.body"]:
|
"thread_id", "content", "content.body"]:
|
||||||
raise SynapseError(400, "Bad select: %s" % (select_key,))
|
raise SynapseError(400, "Bad select: %s" % (select_key,))
|
||||||
except KeyError:
|
|
||||||
pass # select is optional
|
|
||||||
|
|
||||||
if ("bundle_updates" in definition and
|
if ("bundle_updates" in definition and
|
||||||
type(definition["bundle_updates"]) != bool):
|
type(definition["bundle_updates"]) != bool):
|
||||||
|
@ -20,10 +20,6 @@ from ._base import SQLBaseStore
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
# TODO(paul)
|
|
||||||
_filters_for_user = {}
|
|
||||||
|
|
||||||
|
|
||||||
class FilteringStore(SQLBaseStore):
|
class FilteringStore(SQLBaseStore):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_user_filter(self, user_localpart, filter_id):
|
def get_user_filter(self, user_localpart, filter_id):
|
||||||
|
Loading…
Reference in New Issue
Block a user