mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 04:37:00 +00:00
fix(appservice): Re-add room membership conditions for event sending
They accidentally got removed in a recent refactor Fixes #1890
This commit is contained in:
1 file changed
+16
-1
@@ -458,6 +458,16 @@ impl super::Service {
|
||||
pdu: &PduEvent,
|
||||
) -> bool {
|
||||
let room_id = pdu.room_id().unwrap();
|
||||
|
||||
if self
|
||||
.services
|
||||
.state_cache
|
||||
.appservice_in_room(room_id, appservice)
|
||||
.await
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
let target = if *pdu.kind() == TimelineEventType::RoomMember {
|
||||
pdu.state_key().and_then(|sk| UserId::parse(sk).ok())
|
||||
} else {
|
||||
@@ -472,8 +482,13 @@ impl super::Service {
|
||||
| _ => (false, false),
|
||||
};
|
||||
let sender_matches_namespace = appservice.users.is_match(pdu.sender().as_str());
|
||||
let room_matches_namespace = appservice.rooms.is_match(room_id.as_str());
|
||||
|
||||
if target_matches_sender || target_matches_namespace || sender_matches_namespace {
|
||||
if target_matches_sender
|
||||
|| target_matches_namespace
|
||||
|| sender_matches_namespace
|
||||
|| room_matches_namespace
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user