Add doc comment to RoomName::calculate_name.

master
Denis Kasak 2020-06-10 00:28:56 +02:00
parent e4977d1d2a
commit 4c184a30a2
1 changed files with 7 additions and 2 deletions

View File

@ -201,9 +201,14 @@ impl RoomName {
true
}
/// Calculate the canonical display name of a room, taking into account its name, aliases and
/// members.
///
/// The display name is calculated according to [this algorithm][spec].
///
/// [spec]:
/// <https://matrix.org/docs/spec/client_server/latest#calculating-the-display-name-for-a-room>
pub fn calculate_name(&self, members: &HashMap<UserId, RoomMember>) -> String {
// https://matrix.org/docs/spec/client_server/latest#calculating-the-display-name-for-a-room.
// the order in which we check for a name ^^
if let Some(name) = &self.name {
let name = name.trim();
name.to_string()