summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-06-24 11:41:11 +0100
committerDavid Baker <dave@matrix.org>2016-06-24 11:41:11 +0100
commit870c45913ef17584a65d0acf98336f1ddd6bf1c0 (patch)
tree2081f0da923a22df61fa561bb36ac30d44c68828 /synapse/util
parentMerge branch 'master' into develop (diff)
downloadsynapse-870c45913ef17584a65d0acf98336f1ddd6bf1c0.tar.xz
Use similar naming we use in email notifs for push
Fixes https://github.com/vector-im/vector-web/issues/1654
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/presentable_names.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/util/presentable_names.py b/synapse/util/presentable_names.py
index a6866f6117..4c54812e6f 100644
--- a/synapse/util/presentable_names.py
+++ b/synapse/util/presentable_names.py
@@ -25,7 +25,8 @@ ALIAS_RE = re.compile(r"^#.*:.+$")
 ALL_ALONE = "Empty Room"
 
 
-def calculate_room_name(room_state, user_id, fallback_to_members=True):
+def calculate_room_name(room_state, user_id, fallback_to_members=True,
+                        fallback_to_single_member=True):
     """
     Works out a user-facing name for the given room as per Matrix
     spec recommendations.
@@ -129,6 +130,8 @@ def calculate_room_name(room_state, user_id, fallback_to_members=True):
                 return name_from_member_event(all_members[0])
         else:
             return ALL_ALONE
+    elif len(other_members) == 1 and not fallback_to_single_member:
+        return None
     else:
         return descriptor_from_member_events(other_members)