chanserv: PEACE never blocks acting on yourself (self-deop)
All checks were successful
CI / check (push) Successful in 3m58s

!deop with no target deops the caller, but peace_blocks compared the target's
access rank to the caller's — equal for self — so PEACE refused it with 'you
can't act against someone with equal or higher access.' Exempt the self case
(target uid == caller uid) in peace_blocks: acting on yourself isn't acting
against anyone, so you can always drop your own status. Covers DEOP/DEVOICE and
the kick/ban paths too.
This commit is contained in:
Jean Chevronnet 2026-07-16 17:59:00 +00:00
parent 1f6a11dba2
commit 2e92f75a90
No known key found for this signature in database
2 changed files with 34 additions and 0 deletions

View file

@ -360,6 +360,11 @@ fn peace_blocks(me: &str, from: &Sender, chan: &str, target_uid: &str, ctx: &mut
if !info.peace {
return false;
}
// Acting on yourself (e.g. DEOP with no target) isn't acting "against" anyone,
// so PEACE never applies — you can always drop your own status.
if target_uid == from.uid {
return false;
}
if info.access_rank(net.account_of(target_uid)) >= info.access_rank(from.account) {
ctx.notice(me, from.uid, "\x02PEACE\x02 is set: you can't act against someone with equal or higher access.");
return true;