diff --git a/src/session/content/state_row.rs b/src/session/content/state_row.rs index ce476cf3..fda1bea9 100644 --- a/src/session/content/state_row.rs +++ b/src/session/content/state_row.rs @@ -74,31 +74,30 @@ impl StateRow { Some(AnyStateEventContent::RoomMember(prev)) if event.displayname != prev.displayname => { - if prev.displayname == None { + if let Some(prev_name) = prev.displayname { + if event.displayname == None { + Some(gettext!("{} removed their display name.", prev_name)) + } else { + Some(gettext!( + "{} changed their display name to {}.", + prev_name, + display_name + )) + } + } else { Some(gettext!( "{} set their display name to {}.", state.state_key(), display_name )) - } else if event.displayname == None { - Some(gettext!( - "{} removed their display name.", - prev.displayname.unwrap() - )) - } else { - Some(gettext!( - "{} changed their display name to {}.", - prev.displayname.unwrap(), - display_name - )) } } Some(AnyStateEventContent::RoomMember(prev)) if event.avatar_url != prev.avatar_url => { - if prev.displayname == None { + if prev.avatar_url == None { Some(gettext!("{} set their avatar.", display_name)) - } else if event.displayname == None { + } else if event.avatar_url == None { Some(gettext!("{} removed their avatar.", display_name)) } else { Some(gettext!("{} changed their avatar.", display_name)) @@ -113,6 +112,7 @@ impl StateRow { gettext!("{} was invited to this room.", display_name) } MembershipState::Knock => { + // TODO: Add button to invite the user. gettext!("{} requested to be invited to this room.", display_name) } MembershipState::Leave => {