fix: Set proper placeholder texts for system messages (#7953)

Don't use first-person form in placeholder texts,
as these can be misleading when broadcasted to group.
Additionally ensures that broadcasted system messages
are not localized to not leak locally-set language 
to the group chat.

Fixes #7930

Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
Jagoda Estera Ślązak
2026-03-05 15:56:23 +01:00
committed by GitHub
parent 5f84be718a
commit abb93cd79d
2 changed files with 25 additions and 6 deletions

View File

@@ -1416,9 +1416,9 @@ impl MimeFactory {
.await?
.unwrap_or_default()
{
placeholdertext = Some("I left the group.".to_string());
placeholdertext = Some(format!("{email_to_remove} left the group."));
} else {
placeholdertext = Some(format!("I removed member {email_to_remove}."));
placeholdertext = Some(format!("Member {email_to_remove} was removed."));
};
if !email_to_remove.is_empty() {
@@ -1441,7 +1441,7 @@ impl MimeFactory {
let email_to_add = msg.param.get(Param::Arg).unwrap_or_default();
let fingerprint_to_add = msg.param.get(Param::Arg4).unwrap_or_default();
placeholdertext = Some(format!("I added member {email_to_add}."));
placeholdertext = Some(format!("Member {email_to_add} was added."));
if !email_to_add.is_empty() {
headers.push((
@@ -1466,6 +1466,7 @@ impl MimeFactory {
}
}
SystemMessage::GroupNameChanged => {
placeholdertext = Some("Group name changed.".to_string());
let old_name = msg.param.get(Param::Arg).unwrap_or_default().to_string();
headers.push((
"Chat-Group-Name-Changed",
@@ -1482,6 +1483,7 @@ impl MimeFactory {
));
}
SystemMessage::GroupImageChanged => {
placeholdertext = Some("Group image changed.".to_string());
headers.push((
"Chat-Content",
mail_builder::headers::text::Text::new("group-avatar-changed").into(),
@@ -1493,7 +1495,24 @@ impl MimeFactory {
));
}
}
_ => {}
SystemMessage::Unknown => {}
SystemMessage::AutocryptSetupMessage => {}
SystemMessage::SecurejoinMessage => {}
SystemMessage::LocationStreamingEnabled => {}
SystemMessage::LocationOnly => {}
SystemMessage::EphemeralTimerChanged => {}
SystemMessage::ChatProtectionEnabled => {}
SystemMessage::ChatProtectionDisabled => {}
SystemMessage::InvalidUnencryptedMail => {}
SystemMessage::SecurejoinWait => {}
SystemMessage::SecurejoinWaitTimeout => {}
SystemMessage::MultiDeviceSync => {}
SystemMessage::WebxdcStatusUpdate => {}
SystemMessage::WebxdcInfoMessage => {}
SystemMessage::IrohNodeAddr => {}
SystemMessage::ChatE2ee => {}
SystemMessage::CallAccepted => {}
SystemMessage::CallEnded => {}
}
if command == SystemMessage::GroupDescriptionChanged