update room kind on new message

This commit is contained in:
2026-03-12 16:49:57 +07:00
parent c9d1f1c8c3
commit d43383bed1
2 changed files with 17 additions and 5 deletions

View File

@@ -613,9 +613,19 @@ impl ChatRegistry {
/// If the room doesn't exist, it will be created.
/// Updates room ordering based on the most recent messages.
pub fn new_message(&mut self, message: NewMessage, cx: &mut Context<Self>) {
let nostr = NostrRegistry::global(cx);
let signer = nostr.read(cx).signer();
match self.rooms.iter().find(|e| e.read(cx).id == message.room) {
Some(room) => {
room.update(cx, |this, cx| {
if this.kind == RoomKind::Request {
if let Some(public_key) = signer.public_key() {
if message.rumor.pubkey == public_key {
this.set_ongoing(cx);
}
}
}
this.push_message(message, cx);
});
self.sort(cx);