events: Simplify html constructors for text & notice message event contents

This commit is contained in:
Jonas Platte 2020-11-25 18:40:16 +01:00
parent 199f5840dd
commit 1f14cb0393
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -322,11 +322,7 @@ impl NoticeMessageEventContent {
/// A convenience constructor to create an html notice. /// A convenience constructor to create an html notice.
pub fn html(body: impl Into<String>, html_body: impl Into<String>) -> Self { pub fn html(body: impl Into<String>, html_body: impl Into<String>) -> Self {
Self { Self { formatted: Some(FormattedBody::html(html_body)), ..Self::plain(body) }
body: body.into(),
formatted: Some(FormattedBody::html(html_body)),
relates_to: None,
}
} }
} }
@ -443,11 +439,7 @@ impl TextMessageEventContent {
/// A convenience constructor to create an html message. /// A convenience constructor to create an html message.
pub fn html(body: impl Into<String>, html_body: impl Into<String>) -> Self { pub fn html(body: impl Into<String>, html_body: impl Into<String>) -> Self {
Self { Self { formatted: Some(FormattedBody::html(html_body)), ..Self::plain(body) }
body: body.into(),
formatted: Some(FormattedBody::html(html_body)),
relates_to: None,
}
} }
/// A convenience constructor to create a plain text message. /// A convenience constructor to create a plain text message.