push 2 for replied-to messages *am i cooked or am i cooking*
This commit is contained in:
@@ -38,16 +38,25 @@ impl MessageCommand<State> for ReportMessageCommand {
|
||||
.map_err(|_| InteractionError::InteractionNotFound)?
|
||||
.ok_or(InteractionError::InteractionNotFound)?;
|
||||
|
||||
// If the message is a reply, fetch the replied-to message and denormalize its metadata
|
||||
let mut message_metadata = message.message_metadata.clone();
|
||||
if let Some(replying_to_id) = message_metadata.replying_to_id {
|
||||
if let Ok(Some(reply_msg)) = Message::get_by_id(call_id, replying_to_id as u64, db).await {
|
||||
message_metadata.message_replied_to_metadata = Some(Box::new(reply_msg.message_metadata));
|
||||
}
|
||||
}
|
||||
|
||||
// Build the report using the new UDT-based message metadata
|
||||
let report = Report {
|
||||
report_id: get_random_u64(),
|
||||
message: message.message_metadata.clone(),
|
||||
message: message_metadata,
|
||||
created_at: time::OffsetDateTime::now_utc(),
|
||||
reviewed_at: None,
|
||||
created_by_ids: vec![ctx.event.author_id().map(|id| id.get()).unwrap_or(0)],
|
||||
reviewed_by_id: None,
|
||||
resolution: None,
|
||||
};
|
||||
|
||||
|
||||
// Insert the report
|
||||
report.insert(db).await.map_err(|_| InteractionError::DeferringFailed)?;
|
||||
|
||||
Reference in New Issue
Block a user