Migrate interpolated service messages to the t! macro (8 modules)
This commit is contained in:
parent
b462d37bd5
commit
d207c3d60d
133 changed files with 782 additions and 702 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use echo_api::{human_time, Sender, ServiceCtx, Store};
|
||||
use echo_api::{human_time, t, Sender, ServiceCtx, Store};
|
||||
|
||||
// VIEW <id> (aka READ): operators read a ticket in full.
|
||||
pub fn handle(me: &str, from: &Sender, id: Option<&str>, ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
||||
|
|
@ -9,12 +9,12 @@ pub fn handle(me: &str, from: &Sender, id: Option<&str>, ctx: &mut ServiceCtx, d
|
|||
ctx.notice(me, from.uid, "No such ticket. Syntax: VIEW <id>");
|
||||
return;
|
||||
};
|
||||
let state = if !t.open { "closed" } else if t.handler.is_some() { "taken" } else { "open" };
|
||||
ctx.notice(me, from.uid, format!("Ticket \x02#{}\x02 ({state}):", t.id));
|
||||
ctx.notice(me, from.uid, format!(" From : \x02{}\x02", t.requester));
|
||||
let state = if !t.open { t!(ctx, "closed") } else if t.handler.is_some() { t!(ctx, "taken") } else { t!(ctx, "open") };
|
||||
ctx.notice(me, from.uid, t!(ctx, "Ticket \x02#{id}\x02 ({state}):", id = t.id, state = state));
|
||||
ctx.notice(me, from.uid, t!(ctx, " From : \x02{requester}\x02", requester = t.requester));
|
||||
if let Some(h) = &t.handler {
|
||||
ctx.notice(me, from.uid, format!(" Handler : \x02{h}\x02"));
|
||||
ctx.notice(me, from.uid, t!(ctx, " Handler : \x02{handler}\x02", handler = h));
|
||||
}
|
||||
ctx.notice(me, from.uid, format!(" Opened : {}", human_time(t.ts)));
|
||||
ctx.notice(me, from.uid, format!(" Message : {}", t.message));
|
||||
ctx.notice(me, from.uid, t!(ctx, " Opened : {when}", when = human_time(t.ts)));
|
||||
ctx.notice(me, from.uid, t!(ctx, " Message : {msg}", msg = t.message));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue