summary refs log tree commit diff
path: root/synapse/util/presentable_names.py
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2016-06-28 10:12:24 +0100
committerGitHub <noreply@github.com>2016-06-28 10:12:24 +0100
commitdb74dcda5b6e0fea3d80635283bcaea6355f3579 (patch)
tree6d97a0e7ac37e7d5f7c2337e7d4ea2b4efa79132 /synapse/util/presentable_names.py
parentremove vector.im from default secondary DS list (diff)
parentMerge remote-tracking branch 'origin/develop' into dbkr/push_room_naming (diff)
downloadsynapse-db74dcda5b6e0fea3d80635283bcaea6355f3579.tar.xz
Merge pull request #894 from matrix-org/dbkr/push_room_naming
Use similar naming we use in email notifs for push
Diffstat (limited to 'synapse/util/presentable_names.py')
-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)