mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 04:37:00 +00:00
fix: Don't allow set_unsigned to panic
While an error in this function is probably bad, detonating a metric tonne of TNT on the call tree is probably worse
This commit is contained in:
12 files changed
+73
-67
No files matched your search
+21
-13
@@ -6,7 +6,9 @@ use std::collections::VecDeque;
|
||||
use conduwuit::{
|
||||
Event, PduCount, Result, debug_warn, err,
|
||||
matrix::pdu::PduEvent,
|
||||
ref_at, trace,
|
||||
ref_at,
|
||||
result::LogErr,
|
||||
trace,
|
||||
utils::stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt},
|
||||
};
|
||||
use conduwuit_service::Services;
|
||||
@@ -89,12 +91,15 @@ async fn load_timeline(
|
||||
.timeline
|
||||
.get_unsigned_context(&pdu.1, Some(sender_user))
|
||||
.await;
|
||||
pdu.1.set_unsigned(
|
||||
ctx.user_id,
|
||||
ctx.membership,
|
||||
ctx.prev_content,
|
||||
ctx.redacted_because,
|
||||
);
|
||||
pdu.1
|
||||
.set_unsigned(
|
||||
ctx.user_id,
|
||||
ctx.membership,
|
||||
ctx.prev_content,
|
||||
ctx.redacted_because,
|
||||
)
|
||||
.log_err()
|
||||
.ok();
|
||||
Some(pdu)
|
||||
})
|
||||
.then(async move |mut pdu| {
|
||||
@@ -124,12 +129,15 @@ async fn load_timeline(
|
||||
.timeline
|
||||
.get_unsigned_context(&pdu.1, Some(sender_user))
|
||||
.await;
|
||||
pdu.1.set_unsigned(
|
||||
ctx.user_id,
|
||||
ctx.membership,
|
||||
ctx.prev_content,
|
||||
ctx.redacted_because,
|
||||
);
|
||||
pdu.1
|
||||
.set_unsigned(
|
||||
ctx.user_id,
|
||||
ctx.membership,
|
||||
ctx.prev_content,
|
||||
ctx.redacted_because,
|
||||
)
|
||||
.log_err()
|
||||
.ok();
|
||||
Some(pdu)
|
||||
})
|
||||
.then(async move |mut pdu| {
|
||||
|
||||
@@ -6,6 +6,7 @@ use conduwuit::{
|
||||
Event,
|
||||
pdu::{PduCount, PduEvent, sticky},
|
||||
},
|
||||
result::LogErr,
|
||||
trace,
|
||||
utils::{
|
||||
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
||||
@@ -327,7 +328,9 @@ async fn build_sticky_events(
|
||||
.timeline
|
||||
.get_unsigned_context(&pdu, Some(sync_context.syncing_user))
|
||||
.await;
|
||||
pdu.set_unsigned(ctx.user_id, ctx.membership, ctx.prev_content, ctx.redacted_because);
|
||||
pdu.set_unsigned(ctx.user_id, ctx.membership, ctx.prev_content, ctx.redacted_because)
|
||||
.log_err()
|
||||
.ok();
|
||||
events.push(Event::into_format(pdu));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use conduwuit::{
|
||||
Event, TypeStateKey,
|
||||
pdu::{PduCount, PduEvent, sticky},
|
||||
},
|
||||
result::LogErr,
|
||||
trace,
|
||||
utils::{
|
||||
BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt,
|
||||
@@ -1217,7 +1218,9 @@ async fn push_sticky_event(
|
||||
.timeline
|
||||
.get_unsigned_context(&pdu, Some(sender_user))
|
||||
.await;
|
||||
pdu.set_unsigned(ctx.user_id, ctx.membership, ctx.prev_content, ctx.redacted_because);
|
||||
pdu.set_unsigned(ctx.user_id, ctx.membership, ctx.prev_content, ctx.redacted_because)
|
||||
.log_err()
|
||||
.ok();
|
||||
response
|
||||
.rooms
|
||||
.entry(room_id)
|
||||
|
||||
Reference in new issue
Block a user