Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
Fix/notify new message (#45)
Browse files Browse the repository at this point in the history
* fix: handle notification with new message

* chore: minor change
  • Loading branch information
b-avb authored Feb 21, 2024
1 parent 25f7ad7 commit 7640717
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/hooks/use_listen_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ pub fn use_listen_message(cx: &ScopeState) -> &UseListenMessagesState {
let Some(position) = message_position_local else {
msgs.push(message.clone());

plain_message = Some(message_to_plain_content(
&timeline_message.body,
&key_listen_message_image,
&key_listen_message_file,
&key_listen_message_video,
&key_listen_message_html,
));

return;
};

msgs[position] = message.clone()
} else {
plain_message = Some(message_to_plain_content(
&timeline_message.body,
&key_listen_message_image,
&key_listen_message_file,
&key_listen_message_video,
&key_listen_message_html,
));
}
}
}
Expand All @@ -162,18 +162,19 @@ pub fn use_listen_message(cx: &ScopeState) -> &UseListenMessagesState {
if is_in_current_room {
let Some(position) = message_position_local else {
msgs.push(message.clone());
plain_message = Some(message_to_plain_content(
&timeline_message.event.body,
&key_listen_message_image,
&key_listen_message_file,
&key_listen_message_video,
&key_listen_message_html,
));

return;
};

msgs[position] = message.clone()
} else {
plain_message = Some(message_to_plain_content(
&timeline_message.event.body,
&key_listen_message_image,
&key_listen_message_file,
&key_listen_message_video,
&key_listen_message_html,
));
}
}
TimelineRelation::CustomThread(timeline_message) => {
Expand Down Expand Up @@ -389,7 +390,6 @@ pub fn use_listen_message(cx: &ScopeState) -> &UseListenMessagesState {
}
}
}

task_sender.send((
MessageEvent {
room,
Expand Down

0 comments on commit 7640717

Please sign in to comment.