Support sending and displaying message reactions (#2)

This commit is contained in:
Ulyssa 2023-02-09 17:53:33 -08:00
parent 3629f15e0d
commit c9c547acc1
No known key found for this signature in database
GPG key ID: 1B3965A3D18B9B64
10 changed files with 368 additions and 63 deletions

View file

@ -62,7 +62,7 @@ use modalkit::editing::{
use crate::{
base::{IambBufferId, IambInfo, ProgramContext, ProgramStore, RoomFocus, RoomInfo},
config::ApplicationSettings,
message::{Message, MessageCursor, MessageKey},
message::{Message, MessageCursor, MessageKey, Messages},
};
fn nth_key_before(pos: MessageKey, n: usize, info: &RoomInfo) -> MessageKey {
@ -164,11 +164,11 @@ impl ScrollbackState {
.or_else(|| info.messages.last_key_value().map(|kv| kv.0.clone()))
}
pub fn get_mut<'a>(&mut self, info: &'a mut RoomInfo) -> Option<&'a mut Message> {
pub fn get_mut<'a>(&mut self, messages: &'a mut Messages) -> Option<&'a mut Message> {
if let Some(k) = &self.cursor.timestamp {
info.messages.get_mut(k)
messages.get_mut(k)
} else {
info.messages.last_entry().map(|o| o.into_mut())
messages.last_entry().map(|o| o.into_mut())
}
}