Compare commits

..
Author SHA1 Message Date
Ginger 4b09176163 chore: News fragment 2026-12-02 22:22:28 -05:00
Ginger aabdb5003c fix: Stop discarding errors when sending a push notification request 2026-12-02 22:15:49 -05:00
15 changed files with 69 additions and 146 deletions

No files matched your search

Generated
+11 -11
View File
@@ -5049,7 +5049,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.18.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"assign",
"js_int",
@@ -5068,7 +5068,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.18.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"http",
"js_int",
@@ -5081,7 +5081,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.26.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"as_variant",
"assign",
@@ -5103,7 +5103,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.21.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"as_variant",
"base64 0.23.1",
@@ -5136,7 +5136,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.36.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"as_variant",
"indexmap 2.14.2",
@@ -5157,7 +5157,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.17.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"bytes",
"http",
@@ -5179,7 +5179,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.14.1"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"js_int",
"thiserror 2.0.21",
@@ -5188,7 +5188,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.20.3"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"as_variant",
"cfg-if",
@@ -5204,7 +5204,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.17.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"js_int",
"ruma-common",
@@ -5216,7 +5216,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.23.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"base64 0.23.1",
"ed25519-dalek",
@@ -5233,7 +5233,7 @@ dependencies = [
[[package]]
name = "ruma-state-res"
version = "0.19.0"
source = "git+https://github.com/timedoutuk/ruma.git?rev=fd2bf57dfcc2acc30df86054996ce5988bf22d01#fd2bf57dfcc2acc30df86054996ce5988bf22d01"
source = "git+https://github.com/ruma/ruma.git?rev=d6621e1355419c5ef9a7c260b28ae1c0e6722b86#d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
dependencies = [
"js_int",
"ruma-common",
+2 -3
View File
@@ -356,8 +356,8 @@ version = "1.1.1"
# Used for matrix spec type definitions and helpers
[workspace.dependencies.ruma]
git = "https://github.com/timedoutuk/ruma.git"
rev = "fd2bf57dfcc2acc30df86054996ce5988bf22d01"
git = "https://github.com/ruma/ruma.git"
rev = "d6621e1355419c5ef9a7c260b28ae1c0e6722b86"
features = [
"appservice-api-c",
"client-api",
@@ -399,7 +399,6 @@ features = [
"unstable-msc4540",
"unstable-msc4560",
"unstable-msc4563",
"unstable-msc4596",
"unstable-extensible-events",
]
-1
View File
@@ -1 +0,0 @@
Implemented support for [MSC4596: Selective Ignores](https://github.com/matrix-org/matrix-spec-proposals/pull/4596).
+1
View File
@@ -0,0 +1 @@
Errors while sending push notifications will now appear in the server log under more conditions, and will be registered as failures in Prometheus metrics.
-18
View File
@@ -2820,24 +2820,6 @@
# env: CONTINUWUITY_EXPERIMENTS__MSC4563
#msc4563 = false
# MSC4596: Selective Ignores
#
# Adds more granular control over ignoring users, introducing
# "soft-ignores", which instructs the server to send ignored messages to
# the client. Useful for moderators that want to see messages from ignored
# users in rooms they moderate, but nowhere else.
#
# Allows for per-room overrides.
#
# This will likely supersede the
# `send_messages_from_ignored_users_to_client` configuration option, which
# is a global setting that applies to all rooms and users.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4596
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4596
#msc4596 = false
#[global.experiments.msc2815]
# MSC2815: Proposal to allow room moderators to view redacted event content
#
+1 -2
View File
@@ -53,9 +53,8 @@ pub(crate) async fn invite_user_route(
// silently drop invites to users the sender has ignored
if services
.users
.user_ignore_mode(recipient_user, sender_user, None)
.user_is_ignored(recipient_user, sender_user)
.await
.is_some()
{
return Ok(invite_user::v3::Response::new());
}
+19 -22
View File
@@ -34,7 +34,6 @@ use ruma::{
events::{
AnyStateEvent, StateEventType, SyncEphemeralRoomEvent,
TimelineEventType::{self, *},
ignored_user_list::IgnoredUserMode,
receipt::ReceiptEventContent,
},
serde::Raw,
@@ -306,6 +305,10 @@ where
let server_ignored = services
.moderation
.is_remote_server_ignored(sender_user.server_name());
let user_ignored = services
.users
.user_is_ignored(sender_user, recipient_user)
.await;
if !type_ignored {
// We cannot safely ignore this type
@@ -324,28 +327,22 @@ where
};
}
let user_ignore_mode = services
.users
.user_ignore_mode(sender_user, recipient_user, event.room_id())
.await;
match user_ignore_mode {
| None | Some(IgnoredUserMode::Soft) => Ok(false),
| _ => {
// the recipient of this PDU has the sender ignored, and we're not
// configured to send ignored messages to clients
if services.config.experiments.msc4406.is_enabled() {
Err(Error::BadRequest(
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
event.sender().to_owned(),
)),
"You have ignored this sender.",
))
} else {
Err!(Request(NotFound("You have ignored the sender of this event.")))
}
},
if user_ignored && !services.config.send_messages_from_ignored_users_to_client {
// the recipient of this PDU has the sender ignored, and we're not
// configured to send ignored messages to clients
return if services.config.experiments.msc4406.is_enabled() {
Err(Error::BadRequest(
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
event.sender().to_owned(),
)),
"You have ignored this sender.",
))
} else {
Err!(Request(NotFound("You have ignored the sender of this event.")))
};
}
Ok(false)
}
#[inline]
+1 -2
View File
@@ -189,9 +189,8 @@ pub(crate) async fn create_room_route(
// silently drop invites to users the creator has ignored
if services
.users
.user_ignore_mode(recipient_user, sender_user, None)
.user_is_ignored(recipient_user, sender_user)
.await
.is_some()
{
continue;
}
+2 -4
View File
@@ -33,7 +33,6 @@ use ruma::{
events::{
StateEventType,
TimelineEventType::*,
ignored_user_list::IgnoredUserMode,
room::member::{MembershipState, RoomMemberEventContent},
},
serde::Raw,
@@ -163,9 +162,8 @@ async fn build_ephemeral(
.filter_map(async |(read_user, _, edu)| {
let is_ignored = services
.users
.user_ignore_mode(&read_user, syncing_user, Some(room_id))
.await
.is_some_and(|mode| matches!(mode, IgnoredUserMode::Hard));
.user_is_ignored(&read_user, syncing_user)
.await;
// filter out read receipts for ignored users
is_ignored.or_some(edu)
+2 -5
View File
@@ -42,7 +42,6 @@ use ruma::{
AnyStrippedStateEvent, AnySyncEphemeralRoomEvent, AnySyncStateEvent,
GlobalAccountDataEventType, StateEventType, TimelineEventType,
direct::DirectEvent,
ignored_user_list::IgnoredUserMode,
room::{
create::RoomCreateEventContent,
member::{MembershipState, RoomMemberEventContent},
@@ -903,9 +902,8 @@ where
.filter_map(|(read_user, _ts, v)| async move {
services
.users
.user_ignore_mode(&read_user, sender_user, Some(room_id))
.user_is_ignored(&read_user, sender_user)
.await
.is_none_or(|mode| matches!(mode, IgnoredUserMode::Soft))
.or_some(v)
})
.collect()
@@ -1175,9 +1173,8 @@ async fn collect_sticky_events(
}
if services
.users
.user_ignore_mode(pdu.sender(), sender_user, pdu.room_id())
.user_is_ignored(pdu.sender(), sender_user)
.await
.is_some_and(|mode| matches!(mode, IgnoredUserMode::Hard))
{
continue;
}
-18
View File
@@ -159,24 +159,6 @@ pub struct Experiments {
/// default: false
#[serde(default)]
pub msc4563: SimpleExperiment,
/// MSC4596: Selective Ignores
///
/// Adds more granular control over ignoring users, introducing
/// "soft-ignores", which instructs the server to send ignored messages to
/// the client. Useful for moderators that want to see messages from ignored
/// users in rooms they moderate, but nowhere else.
///
/// Allows for per-room overrides.
///
/// This will likely supersede the
/// `send_messages_from_ignored_users_to_client` configuration option, which
/// is a global setting that applies to all rooms and users.
///
/// https://github.com/matrix-org/matrix-spec-proposals/pull/4596
///
/// default: false
pub msc4596: SimpleExperiment,
}
/// Represents a "simple" experiment, which is either disabled or enabled.
+4 -5
View File
@@ -27,7 +27,6 @@ use ruma::{
RoomVersionId, ServerName, UserId,
events::{
AnySyncTimelineEvent, GlobalAccountDataEventType, TimelineEventType,
ignored_user_list::IgnoredUserMode,
push_rules::PushRulesEvent,
room::{
encrypted::Relation,
@@ -403,11 +402,11 @@ impl super::Service {
// Don't notify the sender of their own events, and don't send from ignored users
.ready_filter(|user| *user != pdu.sender())
.filter_map(|recipient_user| async move {
self.services
(!self
.services
.users
.user_ignore_mode(pdu.sender(), &recipient_user, pdu.room_id())
.await
.is_none_or(|mode| matches!(mode, IgnoredUserMode::Soft))
.user_is_ignored(pdu.sender(), &recipient_user)
.await)
.then_some(recipient_user)
})
.collect()
+5 -8
View File
@@ -12,10 +12,7 @@ use ruma::{
appservice::event::push_events::v1::EphemeralData,
federation::transactions::edu::{Edu, TypingContent},
},
events::{
EphemeralRoomEvent, SyncEphemeralRoomEvent, ignored_user_list::IgnoredUserMode,
typing::TypingEventContent,
},
events::{EphemeralRoomEvent, SyncEphemeralRoomEvent, typing::TypingEventContent},
};
use crate::{Dep, globals, sending, sending::EduBuf, sync, users};
@@ -209,11 +206,11 @@ impl Service {
.into_keys()
.stream()
.filter_map(|typing_user_id| async move {
self.services
(!self
.services
.users
.user_ignore_mode(&typing_user_id, sender_user, Some(room_id))
.await
.is_none_or(|mode| matches!(mode, IgnoredUserMode::Soft))
.user_is_ignored(&typing_user_id, sender_user)
.await)
.then_some(typing_user_id)
})
.collect()
+17 -3
View File
@@ -970,6 +970,8 @@ impl Service {
}
}
let mut first_push_error = None;
for pdu in pdus {
// Redacted events are not notification targets (we don't send push
// for them)
@@ -995,15 +997,27 @@ impl Service {
.try_into()
.expect("notification count can't go that high");
let _response = self
let response = self
.services
.pusher
.send_push_notice(&user_id, unread, &pusher, rules_for_user, &pdu)
.await
.map_err(|e| (Destination::Push(user_id.clone(), pushkey.clone()), e));
.map_err(|e| (Destination::Push(user_id.clone(), pushkey.clone()), Box::new(e)));
if let Err(err) = response {
error!(event = %pdu.event_id, pusher = %pusher.app_display_name, "Failed to deliver push notification: {err:?}");
if first_push_error.is_none() {
first_push_error = Some(err);
}
}
}
Ok(Destination::Push(user_id, pushkey))
if let Some(err) = first_push_error {
Err(err)
} else {
Ok(Destination::Push(user_id, pushkey))
}
}
async fn send_events_dest_federation(
+4 -44
View File
@@ -14,13 +14,11 @@ use database::{Deserialized, Json};
use futures::{FutureExt, Stream, StreamExt};
use lettre::Address;
use ruma::{
MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, RoomId, UserId,
MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, UserId,
api::client::profile::PropagateTo,
events::{
GlobalAccountDataEventType,
ignored_user_list::{IgnoredUserListEvent, IgnoredUserMode},
invite_permission_config::InvitePermissionAction,
push_rules::PushRulesEvent,
GlobalAccountDataEventType, ignored_user_list::IgnoredUserListEvent,
invite_permission_config::InvitePermissionAction, push_rules::PushRulesEvent,
room::message::RoomMessageEventContent,
},
profile::ProfileFieldValue,
@@ -67,7 +65,6 @@ impl AccountStatus {
impl super::Service {
/// Returns true/false based on whether the recipient/receiving user has
/// ignored the sender.
#[deprecated(note = "Use user_ignore_mode instead")]
pub async fn user_is_ignored(&self, sender_user: &UserId, recipient_user: &UserId) -> bool {
self.services
.account_data
@@ -82,39 +79,6 @@ impl super::Service {
})
}
/// Returns the recipient's ignore mode for the sender, if the sender is
/// ignored. `None` if the recipient is not ignored at all.
pub async fn user_ignore_mode(
&self,
sender_user: &UserId,
recipient_user: &UserId,
room_id: Option<&RoomId>,
) -> Option<IgnoredUserMode> {
self.services
.account_data
.get_global(recipient_user, GlobalAccountDataEventType::IgnoredUserList)
.await
.ok()
.and_then(|ignored: IgnoredUserListEvent| {
ignored
.content
.ignored_users
.get(sender_user)
.map(ToOwned::to_owned)
})
.map(|ignore_entry| {
if !self.services.config.experiments.msc4596.is_enabled() {
IgnoredUserMode::Hard
} else {
match room_id {
| Some(room_id) => ignore_entry.mode(room_id),
| None => &ignore_entry.mode,
}
.to_owned()
}
})
}
/// Returns the recipient's filter level for an invite from the sender.
///
/// If the sender is ignored by the recipient, `Ignore` is returned.
@@ -125,11 +89,7 @@ impl super::Service {
sender_user: &UserId,
recipient_user: &UserId,
) -> FilterLevel {
if self
.user_ignore_mode(sender_user, recipient_user, None)
.await
.is_some()
{
if self.user_is_ignored(sender_user, recipient_user).await {
FilterLevel::Ignore
} else {
let (stable, unstable) = tokio::join!(