mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
only log banned users if they are local
This was the intent of f03b6cde29, but it
was missing the check that the user is actually local, and so was
logging *all* banned users.
This commit is contained in:
parent
f03b6cde29
commit
4ad50e2708
2 changed files with 23 additions and 17 deletions
|
|
@ -203,4 +203,5 @@ This will be the first release of Grapevine since it was forked from Conduit
|
|||
13. Support building nix packages without IFD
|
||||
([!73](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/73))
|
||||
14. Report local users getting banned in the server logs and admin room.
|
||||
([!65](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/65))
|
||||
([!65](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/65),
|
||||
[!84](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/84))
|
||||
|
|
|
|||
|
|
@ -477,24 +477,29 @@ impl Service {
|
|||
if membership == MembershipState::Ban {
|
||||
let (room, user) = (&pdu.room_id, &target_user_id);
|
||||
|
||||
info!(
|
||||
%user,
|
||||
%room,
|
||||
reason,
|
||||
"User has been banned from room"
|
||||
);
|
||||
if user.server_name()
|
||||
== services().globals.server_name()
|
||||
{
|
||||
info!(
|
||||
%user,
|
||||
%room,
|
||||
reason,
|
||||
"User has been banned from room"
|
||||
);
|
||||
|
||||
let reason = match reason.filter(|s| !s.is_empty()) {
|
||||
Some(s) => format!(": {s}"),
|
||||
None => String::new(),
|
||||
};
|
||||
let reason = match reason.filter(|s| !s.is_empty())
|
||||
{
|
||||
Some(s) => format!(": {s}"),
|
||||
None => String::new(),
|
||||
};
|
||||
|
||||
services().admin.send_message(
|
||||
RoomMessageEventContent::notice_plain(format!(
|
||||
"User {user} has been banned from room \
|
||||
{room}{reason}",
|
||||
)),
|
||||
);
|
||||
services().admin.send_message(
|
||||
RoomMessageEventContent::notice_plain(format!(
|
||||
"User {user} has been banned from room \
|
||||
{room}{reason}",
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Update our membership info, we do this here incase a user
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue