@@ -54,6 +54,9 @@ pub enum LatestEventValue {
5454 /// The timestamp of the local event.
5555 timestamp : MilliSecondsSinceUnixEpoch ,
5656
57+ /// The sender's profile.
58+ profile : TimelineDetails < Profile > ,
59+
5760 /// The content of the local event.
5861 content : TimelineItemContent ,
5962
@@ -114,11 +117,17 @@ impl LatestEventValue {
114117 return Self :: None ;
115118 } ;
116119
120+ let sender = client. user_id ( ) . expect ( "The `Client` is supposed to be logged" ) ;
121+ let profile = room
122+ . profile_from_user_id ( sender)
123+ . await
124+ . map ( TimelineDetails :: Ready )
125+ . unwrap_or ( TimelineDetails :: Unavailable ) ;
117126 let is_sending = matches ! ( value, BaseLatestEventValue :: LocalIsSending ( _) ) ;
118127
119128 match TimelineAction :: from_content ( message_like_event_content, None , None , None ) {
120129 TimelineAction :: AddItem { content } => {
121- Self :: Local { timestamp, content, is_sending }
130+ Self :: Local { timestamp, profile , content, is_sending }
122131 }
123132
124133 TimelineAction :: HandleAggregation { kind, .. } => {
@@ -226,8 +235,9 @@ mod tests {
226235 let value =
227236 LatestEventValue :: from_base_latest_event_value ( base_value, & room, & client) . await ;
228237
229- assert_matches ! ( value, LatestEventValue :: Local { timestamp, content, is_sending } => {
238+ assert_matches ! ( value, LatestEventValue :: Local { timestamp, profile , content, is_sending } => {
230239 assert_eq!( u64 :: from( timestamp. get( ) ) , 42u64 ) ;
240+ assert_matches!( profile, TimelineDetails :: Unavailable ) ;
231241 assert_matches!(
232242 content,
233243 TimelineItemContent :: MsgLike ( MsgLikeContent { kind: MsgLikeKind :: Message ( _) , .. } )
@@ -255,8 +265,9 @@ mod tests {
255265 let value =
256266 LatestEventValue :: from_base_latest_event_value ( base_value, & room, & client) . await ;
257267
258- assert_matches ! ( value, LatestEventValue :: Local { timestamp, content, is_sending } => {
268+ assert_matches ! ( value, LatestEventValue :: Local { timestamp, profile , content, is_sending } => {
259269 assert_eq!( u64 :: from( timestamp. get( ) ) , 42u64 ) ;
270+ assert_matches!( profile, TimelineDetails :: Unavailable ) ;
260271 assert_matches!(
261272 content,
262273 TimelineItemContent :: MsgLike ( MsgLikeContent { kind: MsgLikeKind :: Message ( _) , .. } )
0 commit comments