mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-19 21:29:52 -07:00
Emote messages should always show sender (#65)
This commit is contained in:
parent
e6cdd02f22
commit
e98d58a8cc
1 changed files with 21 additions and 1 deletions
|
@ -342,6 +342,23 @@ impl MessageEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn content(&self) -> Option<&RoomMessageEventContent> {
|
||||||
|
match self {
|
||||||
|
MessageEvent::EncryptedOriginal(_) => None,
|
||||||
|
MessageEvent::Original(ev) => Some(&ev.content),
|
||||||
|
MessageEvent::EncryptedRedacted(_) => None,
|
||||||
|
MessageEvent::Redacted(_) => None,
|
||||||
|
MessageEvent::Local(_, content) => Some(content),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_emote(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self.content(),
|
||||||
|
Some(RoomMessageEventContent { msgtype: MessageType::Emote(_), .. })
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn body(&self) -> Cow<'_, str> {
|
pub fn body(&self) -> Cow<'_, str> {
|
||||||
match self {
|
match self {
|
||||||
MessageEvent::EncryptedOriginal(_) => "[Unable to decrypt message]".into(),
|
MessageEvent::EncryptedOriginal(_) => "[Unable to decrypt message]".into(),
|
||||||
|
@ -771,7 +788,10 @@ impl Message {
|
||||||
settings: &ApplicationSettings,
|
settings: &ApplicationSettings,
|
||||||
) -> Option<Span> {
|
) -> Option<Span> {
|
||||||
if let Some(prev) = prev {
|
if let Some(prev) = prev {
|
||||||
if self.sender == prev.sender && self.timestamp.same_day(&prev.timestamp) {
|
if self.sender == prev.sender &&
|
||||||
|
self.timestamp.same_day(&prev.timestamp) &&
|
||||||
|
!self.event.is_emote()
|
||||||
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue