-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Update to latest Ruma version #4532
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,18 +39,18 @@ use ruma::{ | |
events::{ | ||
poll::unstable_start::{NewUnstablePollStartEventContent, UnstablePollStartEventContent}, | ||
receipt::{Receipt, ReceiptThread}, | ||
relation::Thread, | ||
room::{ | ||
message::{ | ||
AddMentions, ForwardThread, OriginalRoomMessageEvent, | ||
RoomMessageEventContentWithoutRelation, | ||
AddMentions, ForwardThread, ReplyMetadata, RoomMessageEventContentWithoutRelation, | ||
}, | ||
pinned_events::RoomPinnedEventsEventContent, | ||
}, | ||
AnyMessageLikeEventContent, AnySyncMessageLikeEvent, AnySyncTimelineEvent, | ||
SyncMessageLikeEvent, | ||
}, | ||
serde::Raw, | ||
EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedUserId, RoomVersionId, UserId, | ||
EventId, OwnedEventId, OwnedUserId, RoomVersionId, UserId, | ||
}; | ||
use thiserror::Error; | ||
use tracing::{error, instrument, trace, warn}; | ||
|
@@ -104,8 +104,6 @@ pub struct RepliedToInfo { | |
event_id: OwnedEventId, | ||
/// The sender of the event to reply to. | ||
sender: OwnedUserId, | ||
/// The timestamp of the event to reply to. | ||
timestamp: MilliSecondsSinceUnixEpoch, | ||
/// The content of the event to reply to. | ||
content: ReplyContent, | ||
Comment on lines
107
to
108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of the full |
||
} | ||
|
@@ -343,7 +341,8 @@ impl Timeline { | |
replied_to_info: RepliedToInfo, | ||
forward_thread: ForwardThread, | ||
) -> Result<(), RoomSendQueueError> { | ||
let event_id = replied_to_info.event_id; | ||
let event_id = &replied_to_info.event_id; | ||
let sender = &replied_to_info.sender; | ||
|
||
// [The specification](https://spec.matrix.org/v1.10/client-server-api/#user-and-room-mentions) says: | ||
// | ||
|
@@ -352,32 +351,21 @@ impl Timeline { | |
// | ||
// If the replied to event has been written by the current user, let's toggle to | ||
// `AddMentions::No`. | ||
let mention_the_sender = if self.room().own_user_id() == replied_to_info.sender { | ||
AddMentions::No | ||
} else { | ||
AddMentions::Yes | ||
let mention_the_sender = | ||
if self.room().own_user_id() == sender { AddMentions::No } else { AddMentions::Yes }; | ||
|
||
let thread = match replied_to_info.content { | ||
ReplyContent::Message(message) => message | ||
.thread_root() | ||
.map(|thread_root| Thread::plain(thread_root.clone(), event_id.clone())), | ||
ReplyContent::Raw(_raw_event) => None, | ||
}; | ||
|
||
let content = match replied_to_info.content { | ||
ReplyContent::Message(msg) => { | ||
let event = OriginalRoomMessageEvent { | ||
event_id: event_id.to_owned(), | ||
sender: replied_to_info.sender, | ||
origin_server_ts: replied_to_info.timestamp, | ||
room_id: self.room().room_id().to_owned(), | ||
content: msg.to_content(), | ||
unsigned: Default::default(), | ||
}; | ||
content.make_reply_to(&event, forward_thread, mention_the_sender) | ||
} | ||
ReplyContent::Raw(raw_event) => content.make_reply_to_raw( | ||
&raw_event, | ||
event_id.to_owned(), | ||
self.room().room_id(), | ||
forward_thread, | ||
mention_the_sender, | ||
), | ||
}; | ||
let content = content.make_reply_to( | ||
ReplyMetadata::new(event_id, sender, thread.as_ref()), | ||
forward_thread, | ||
mention_the_sender, | ||
); | ||
|
||
self.send(content.into()).await?; | ||
|
||
|
@@ -425,7 +413,6 @@ impl Timeline { | |
Ok(RepliedToInfo { | ||
event_id: event_id.to_owned(), | ||
sender: sync_event.sender().to_owned(), | ||
timestamp: sync_event.origin_server_ts(), | ||
content: reply_content, | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a comment should be added to only update Ruma using the
ruma-0.12
branch, to make sure no one tries to update using themain
branch before we plan to make a breaking release?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea.