summary refs log tree commit diff
path: root/synapse/server_notices
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-05-23 17:43:30 +0100
committerRichard van der Hoff <richard@matrix.org>2018-05-23 17:43:30 +0100
commit9bf4b2bda343dcbdba7b0e9d752bc560f8e344fd (patch)
treeaf04617ba94617b47934773bceb852334a6b5b82 /synapse/server_notices
parentMerge docs on consent bits from PR #3268 into release branch (diff)
downloadsynapse-9bf4b2bda343dcbdba7b0e9d752bc560f8e344fd.tar.xz
Allow overriding the server_notices user's avatar
probably should have done this in the first place, like @turt2live suggested.
Diffstat (limited to 'synapse/server_notices')
-rw-r--r--synapse/server_notices/server_notices_manager.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/synapse/server_notices/server_notices_manager.py b/synapse/server_notices/server_notices_manager.py
index 7e4055c84a..a26deace53 100644
--- a/synapse/server_notices/server_notices_manager.py
+++ b/synapse/server_notices/server_notices_manager.py
@@ -113,6 +113,19 @@ class ServerNoticesManager(object):
         # apparently no existing notice room: create a new one
         logger.info("Creating server notices room for %s", user_id)
 
+        # see if we want to override the profile info for the server user.
+        # note that if we want to override either the display name or the
+        # avatar, we have to use both.
+        join_profile = None
+        if (
+            self._config.server_notices_mxid_display_name is not None or
+            self._config.server_notices_mxid_avatar_url is not None
+        ):
+            join_profile = {
+                "displayname": self._config.server_notices_mxid_display_name,
+                "avatar_url": self._config.server_notices_mxid_avatar_url,
+            }
+
         requester = create_requester(system_mxid)
         info = yield self._room_creation_handler.create_room(
             requester,
@@ -125,9 +138,7 @@ class ServerNoticesManager(object):
                 "invite": (user_id,)
             },
             ratelimit=False,
-            creator_join_profile={
-                "displayname": self._config.server_notices_mxid_display_name,
-            },
+            creator_join_profile=join_profile,
         )
         room_id = info['room_id']