Refactor displayname and fix avatar_url

This commit is contained in:
Kévin Commaille 2021-05-18 16:01:11 +02:00
parent 5248f83af9
commit a680a4e52d
No known key found for this signature in database
GPG key ID: 296D60AE1E61661C

View file

@ -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 => {