refactor for readability, and reuse caching for setting tags

This commit is contained in:
Neil Johnson 2018-08-16 17:02:04 +01:00
parent eff3ae3b9a
commit 3c1080b6e4
3 changed files with 110 additions and 63 deletions

View file

@ -22,6 +22,8 @@ from synapse.util.caches.descriptors import cachedInlineCallbacks
logger = logging.getLogger(__name__)
SERVER_NOTICE_ROOM_TAG = "m.server_notice"
class ServerNoticesManager(object):
def __init__(self, hs):
@ -151,7 +153,9 @@ class ServerNoticesManager(object):
creator_join_profile=join_profile,
)
room_id = info['room_id']
yield self._store.add_tag_to_room(user_id, room_id, 'm.server_notice', None)
yield self._store.add_tag_to_room(
user_id, room_id, SERVER_NOTICE_ROOM_TAG, None
)
logger.info("Created server notices room %s for %s", room_id, user_id)
defer.returnValue(room_id)