diff options
author | David Baker <dave@matrix.org> | 2016-04-29 19:47:35 +0100 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2016-04-29 19:47:35 +0100 |
commit | c7c75e87dc6b619d07d224bd4c6464313cc96840 (patch) | |
tree | f8a0e1073b1cc73a608627db929f4723ea34c2d7 | |
parent | Use explicit join (diff) | |
download | synapse-c7c75e87dc6b619d07d224bd4c6464313cc96840.tar.xz |
Docstring
-rw-r--r-- | synapse/util/presentable_names.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/util/presentable_names.py b/synapse/util/presentable_names.py index 13def91776..3efa8a8206 100644 --- a/synapse/util/presentable_names.py +++ b/synapse/util/presentable_names.py @@ -23,6 +23,20 @@ ALL_ALONE = "Empty Room" def calculate_room_name(room_state, user_id, fallback_to_members=True): + """ + Works out a user-facing name for the given room as per Matrix + spec recommendations. + Does not yet support internationalisation. + Args: + room_state: Dictionary of the room's state + user_id: The ID of the user to whom the room name is being presented + fallback_to_members: If False, return None instead of generating a name + based on the room's members if the room has no + title or aliases. + + Returns: + (string or None) A human readable name for the room. + """ # does it have a name? if ("m.room.name", "") in room_state: m_room_name = room_state[("m.room.name", "")] |