OperServ: INFO staff notes on accounts and channels

INFO ADD <target> <note> / DEL <target> / <target> attaches a staff note
to an account or channel (a #name is a channel, else an account). The note
is shown in that service's INFO — but to operators only (Priv::Auspex),
never to the account's own owner. Admin-only to set.

Follows the typed-field-on-the-entity pattern: an oper_note field folded
through AccountOperNoteSet (Global) / ChannelOperNoteSet (Local) events,
read via dedicated Store getters so it stays out of the public views and
the directory feed.
This commit is contained in:
Jean Chevronnet 2026-07-14 01:15:00 +00:00
parent 8ccc9fa8ea
commit 51d4ebf789
No known key found for this signature in database
8 changed files with 216 additions and 9 deletions

View file

@ -1,4 +1,4 @@
use fedserv_api::{ChanError, ChannelView, Store};
use fedserv_api::{ChanError, ChannelView, Priv, Store};
use fedserv_api::{Sender, Service, ServiceCtx};
use fedserv_api::NetView;
@ -118,6 +118,12 @@ impl Service for ChanServ {
if !opts.is_empty() {
ctx.notice(me, from.uid, format!(" Options : {}", opts.join(", ")));
}
// A staff note is shown to operators only.
if from.privs.has(Priv::Auspex) {
if let Some(note) = db.channel_note(chan) {
ctx.notice(me, from.uid, format!(" Staff note : {note}"));
}
}
}
None => ctx.notice(me, from.uid, format!("\x02{chan}\x02 isn't registered.")),
}