Return whether event already existed from event_handler.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -57,11 +57,11 @@ pub async fn handle_incoming_pdu<'a>(
|
||||
event_id: &'a EventId,
|
||||
pdu: CanonicalJsonObject,
|
||||
is_timeline_event: bool,
|
||||
) -> Result<Option<RawPduId>> {
|
||||
) -> Result<Option<(RawPduId, bool)>> {
|
||||
// 1. Skip the PDU if we already have it as a timeline event
|
||||
if let Ok(pdu_id) = self.services.timeline.get_pdu_id(event_id).await {
|
||||
trace!(?event_id, "exists");
|
||||
return Ok(Some(pdu_id));
|
||||
return Ok(Some((pdu_id, false)));
|
||||
}
|
||||
|
||||
// 1.1 Check the server is in the room
|
||||
|
||||
@@ -28,7 +28,7 @@ pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
||||
val: CanonicalJsonObject,
|
||||
room_version: &RoomVersionId,
|
||||
create_event_id: &EventId,
|
||||
) -> Result<Option<RawPduId>> {
|
||||
) -> Result<Option<(RawPduId, bool)>> {
|
||||
// Skip the PDU if we already have it as a timeline event
|
||||
if let Ok(pduid) = self
|
||||
.services
|
||||
@@ -36,7 +36,7 @@ pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
||||
.get_pdu_id(incoming_pdu.event_id())
|
||||
.await
|
||||
{
|
||||
return Ok(Some(pduid));
|
||||
return Ok(Some((pduid, false)));
|
||||
}
|
||||
|
||||
if self
|
||||
@@ -270,5 +270,5 @@ pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
||||
"Accepted",
|
||||
);
|
||||
|
||||
Ok(pdu_id)
|
||||
Ok(pdu_id.zip(Some(true)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user