events: Don't add reply fallback in thread fallback
This commit is contained in:
parent
92f862e279
commit
9b2117cbf6
@ -239,33 +239,39 @@ impl RoomMessageEventContent {
|
|||||||
/// thread is created. If it doesn't, a new thread with `previous_message` as the root is
|
/// thread is created. If it doesn't, a new thread with `previous_message` as the root is
|
||||||
/// created.
|
/// created.
|
||||||
///
|
///
|
||||||
/// If `message` is a text or notice message, it is modified to include the rich reply fallback.
|
/// If `message` is a text or notice message, and this is a reply in the thread, it is modified
|
||||||
|
/// to include the rich reply fallback.
|
||||||
#[cfg(feature = "unstable-msc3440")]
|
#[cfg(feature = "unstable-msc3440")]
|
||||||
pub fn for_thread(
|
pub fn for_thread(
|
||||||
message: MessageType,
|
message: MessageType,
|
||||||
previous_message: &OriginalRoomMessageEvent,
|
previous_message: &OriginalRoomMessageEvent,
|
||||||
is_reply: ReplyInThread,
|
is_reply: ReplyInThread,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let msgtype = match message {
|
let msgtype = if is_reply == ReplyInThread::Yes {
|
||||||
MessageType::Text(TextMessageEventContent { body, formatted, .. }) => {
|
// If this is a real reply, add the rich reply fallback.
|
||||||
let (body, html_body) = reply::plain_and_formatted_reply_body(
|
match message {
|
||||||
body,
|
MessageType::Text(TextMessageEventContent { body, formatted, .. }) => {
|
||||||
formatted.map(|f| f.body),
|
let (body, html_body) = reply::plain_and_formatted_reply_body(
|
||||||
previous_message,
|
body,
|
||||||
);
|
formatted.map(|f| f.body),
|
||||||
|
previous_message,
|
||||||
|
);
|
||||||
|
|
||||||
MessageType::Text(TextMessageEventContent::html(body, html_body))
|
MessageType::Text(TextMessageEventContent::html(body, html_body))
|
||||||
}
|
}
|
||||||
MessageType::Notice(NoticeMessageEventContent { body, formatted, .. }) => {
|
MessageType::Notice(NoticeMessageEventContent { body, formatted, .. }) => {
|
||||||
let (body, html_body) = reply::plain_and_formatted_reply_body(
|
let (body, html_body) = reply::plain_and_formatted_reply_body(
|
||||||
body,
|
body,
|
||||||
formatted.map(|f| f.body),
|
formatted.map(|f| f.body),
|
||||||
previous_message,
|
previous_message,
|
||||||
);
|
);
|
||||||
|
|
||||||
MessageType::Notice(NoticeMessageEventContent::html(body, html_body))
|
MessageType::Notice(NoticeMessageEventContent::html(body, html_body))
|
||||||
|
}
|
||||||
|
_ => message,
|
||||||
}
|
}
|
||||||
_ => message,
|
} else {
|
||||||
|
message
|
||||||
};
|
};
|
||||||
|
|
||||||
let thread_root = if let Some(Relation::Thread(Thread { event_id, .. })) =
|
let thread_root = if let Some(Relation::Thread(Thread { event_id, .. })) =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user