support timestamped appservice messaging
Co-authored-by: strawberry <strawberry@puppygock.gay> Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
committed by
Jason Volk
parent
66679c7522
commit
2d9aab2e79
@@ -403,6 +403,7 @@ pub(crate) async fn kick_user_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(body.user_id.to_string()),
|
state_key: Some(body.user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
@@ -465,6 +466,7 @@ pub(crate) async fn ban_user_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(body.user_id.to_string()),
|
state_key: Some(body.user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
@@ -512,6 +514,7 @@ pub(crate) async fn unban_user_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(body.user_id.to_string()),
|
state_key: Some(body.user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
@@ -1100,6 +1103,7 @@ async fn join_room_by_id_helper_local(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(sender_user.to_string()),
|
state_key: Some(sender_user.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
room_id,
|
room_id,
|
||||||
@@ -1412,6 +1416,7 @@ pub(crate) async fn invite_helper(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
room_id,
|
room_id,
|
||||||
@@ -1523,6 +1528,7 @@ pub(crate) async fn invite_helper(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
room_id,
|
room_id,
|
||||||
@@ -1640,6 +1646,7 @@ pub async fn leave_room(services: &Services, user_id: &UserId, room_id: &RoomId,
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
user_id,
|
user_id,
|
||||||
room_id,
|
room_id,
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ pub(crate) async fn send_message_event_route(
|
|||||||
unsigned: Some(unsigned),
|
unsigned: Some(unsigned),
|
||||||
state_key: None,
|
state_key: None,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: if body.appservice_info.is_some() {
|
||||||
|
body.timestamp
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
},
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ pub async fn update_displayname(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
room_id,
|
room_id,
|
||||||
))
|
))
|
||||||
@@ -355,6 +356,7 @@ pub async fn update_avatar_url(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
room_id,
|
room_id,
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pub(crate) async fn redact_event_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: None,
|
state_key: None,
|
||||||
redacts: Some(body.event_id.into()),
|
redacts: Some(body.event_id.into()),
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -225,6 +226,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(sender_user.to_string()),
|
state_key: Some(sender_user.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -262,6 +264,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -285,6 +288,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -311,6 +315,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -330,6 +335,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -352,6 +358,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -405,6 +412,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -427,6 +435,7 @@ pub(crate) async fn create_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -581,6 +590,7 @@ pub(crate) async fn upgrade_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
@@ -672,6 +682,7 @@ pub(crate) async fn upgrade_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&replacement_room,
|
&replacement_room,
|
||||||
@@ -700,6 +711,7 @@ pub(crate) async fn upgrade_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(sender_user.to_string()),
|
state_key: Some(sender_user.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&replacement_room,
|
&replacement_room,
|
||||||
@@ -728,6 +740,7 @@ pub(crate) async fn upgrade_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&replacement_room,
|
&replacement_room,
|
||||||
@@ -786,6 +799,7 @@ pub(crate) async fn upgrade_room_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ pub(crate) async fn send_state_event_for_key_route(
|
|||||||
&body.event_type,
|
&body.event_type,
|
||||||
&body.body.body,
|
&body.body.body,
|
||||||
body.state_key.clone(),
|
body.state_key.clone(),
|
||||||
|
if body.appservice_info.is_some() {
|
||||||
|
body.timestamp
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.into(),
|
.into(),
|
||||||
@@ -172,7 +177,7 @@ pub(crate) async fn get_state_events_for_empty_key_route(
|
|||||||
|
|
||||||
async fn send_state_event_for_key_helper(
|
async fn send_state_event_for_key_helper(
|
||||||
services: &Services, sender: &UserId, room_id: &RoomId, event_type: &StateEventType,
|
services: &Services, sender: &UserId, room_id: &RoomId, event_type: &StateEventType,
|
||||||
json: &Raw<AnyStateEventContent>, state_key: String,
|
json: &Raw<AnyStateEventContent>, state_key: String, timestamp: Option<ruma::MilliSecondsSinceUnixEpoch>,
|
||||||
) -> Result<Arc<EventId>> {
|
) -> Result<Arc<EventId>> {
|
||||||
allowed_to_send_state_event(services, room_id, event_type, json).await?;
|
allowed_to_send_state_event(services, room_id, event_type, json).await?;
|
||||||
let state_lock = services.rooms.state.mutex.lock(room_id).await;
|
let state_lock = services.rooms.state.mutex.lock(room_id).await;
|
||||||
@@ -186,6 +191,7 @@ async fn send_state_event_for_key_helper(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(state_key),
|
state_key: Some(state_key),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp,
|
||||||
},
|
},
|
||||||
sender,
|
sender,
|
||||||
room_id,
|
room_id,
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ pub(crate) async fn create_join_event_template_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(body.user_id.to_string()),
|
state_key: Some(body.user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
&body.user_id,
|
&body.user_id,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ pub(crate) async fn create_leave_event_template_route(
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(body.user_id.to_string()),
|
state_key: Some(body.user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
&body.user_id,
|
&body.user_id,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{collections::BTreeMap, sync::Arc};
|
use std::{collections::BTreeMap, sync::Arc};
|
||||||
|
|
||||||
use ruma::{events::TimelineEventType, EventId};
|
use ruma::{events::TimelineEventType, EventId, MilliSecondsSinceUnixEpoch};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::value::RawValue as RawJsonValue;
|
use serde_json::value::RawValue as RawJsonValue;
|
||||||
|
|
||||||
@@ -13,4 +13,8 @@ pub struct PduBuilder {
|
|||||||
pub unsigned: Option<BTreeMap<String, serde_json::Value>>,
|
pub unsigned: Option<BTreeMap<String, serde_json::Value>>,
|
||||||
pub state_key: Option<String>,
|
pub state_key: Option<String>,
|
||||||
pub redacts: Option<Arc<EventId>>,
|
pub redacts: Option<Arc<EventId>>,
|
||||||
|
/// For timestamped messaging, should only be used for appservices
|
||||||
|
///
|
||||||
|
/// Will be set to current time if None
|
||||||
|
pub timestamp: Option<MilliSecondsSinceUnixEpoch>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -99,6 +100,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(server_user.to_string()),
|
state_key: Some(server_user.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -124,6 +126,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -143,6 +146,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -162,6 +166,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -181,6 +186,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -201,6 +207,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -221,6 +228,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -245,6 +253,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -271,6 +280,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ impl super::Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -75,6 +76,7 @@ impl super::Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(user_id.to_string()),
|
state_key: Some(user_id.to_string()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
user_id,
|
user_id,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -100,6 +102,7 @@ impl super::Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(String::new()),
|
state_key: Some(String::new()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
@@ -119,6 +122,7 @@ impl super::Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: None,
|
state_key: None,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
},
|
},
|
||||||
server_user,
|
server_user,
|
||||||
&room_id,
|
&room_id,
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ impl Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: None,
|
state_key: None,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = self
|
if let Err(e) = self
|
||||||
@@ -289,6 +290,7 @@ impl Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: None,
|
state_key: None,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.services
|
self.services
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ impl Service {
|
|||||||
unsigned: None,
|
unsigned: None,
|
||||||
state_key: Some(target_user.into()),
|
state_key: Some(target_user.into()),
|
||||||
redacts: None,
|
redacts: None,
|
||||||
|
timestamp: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(self
|
Ok(self
|
||||||
|
|||||||
@@ -638,6 +638,7 @@ impl Service {
|
|||||||
unsigned,
|
unsigned,
|
||||||
state_key,
|
state_key,
|
||||||
redacts,
|
redacts,
|
||||||
|
timestamp,
|
||||||
} = pdu_builder;
|
} = pdu_builder;
|
||||||
|
|
||||||
let prev_events: Vec<_> = self
|
let prev_events: Vec<_> = self
|
||||||
@@ -705,9 +706,14 @@ impl Service {
|
|||||||
room_id: room_id.to_owned(),
|
room_id: room_id.to_owned(),
|
||||||
sender: sender.to_owned(),
|
sender: sender.to_owned(),
|
||||||
origin: None,
|
origin: None,
|
||||||
origin_server_ts: utils::millis_since_unix_epoch()
|
origin_server_ts: timestamp.map_or_else(
|
||||||
.try_into()
|
|| {
|
||||||
.expect("time is valid"),
|
utils::millis_since_unix_epoch()
|
||||||
|
.try_into()
|
||||||
|
.expect("u64 fits into UInt")
|
||||||
|
},
|
||||||
|
|ts| ts.get(),
|
||||||
|
),
|
||||||
kind: event_type,
|
kind: event_type,
|
||||||
content,
|
content,
|
||||||
state_key,
|
state_key,
|
||||||
|
|||||||
Reference in New Issue
Block a user