echo/modules/helpserv/src/cancel.rs
Jean 993f5b2eea
Rename the project to Echo (was fedserv)
Rebrand the daemon and workspace: the binary is now `echo`, every crate
is `echo-*` (`echo-api` and the module crates), Rust imports use
`echo_*`, the gRPC proto is `proto/echo.proto` with package `echo.v1`,
and the log filter, gossip peer-name default, and on-disk store default
(`echo.db.jsonl`) follow. Docs updated throughout. No behaviour change;
crate directories and the config schema are untouched.
2026-07-14 15:24:41 +00:00

14 lines
594 B
Rust

use echo_api::{Sender, ServiceCtx, Store};
// CANCEL: withdraw your own newest open ticket.
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &mut dyn Store) {
let who = from.account.unwrap_or(from.nick);
let mine = db.help_tickets(true).into_iter().find(|t| t.requester.eq_ignore_ascii_case(who));
match mine {
Some(t) => {
db.help_close(t.id);
ctx.notice(me, from.uid, format!("Your request \x02#{}\x02 has been cancelled.", t.id));
}
None => ctx.notice(me, from.uid, "You have no open request to cancel."),
}
}