Skip to content

Commit 7d869bf

Browse files
committed
feat(audit_log): add i18n keys and fix type handling
1 parent 180f4d8 commit 7d869bf

2 files changed

Lines changed: 616 additions & 6 deletions

File tree

rustmail/src/handlers/audit_log/mod.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub const COLOR_NEUTRAL: u32 = 0x99AAB5;
1919

2020
#[derive(Debug, Clone)]
2121
pub struct AuditLogContext<'a> {
22-
pub ctx: &'a Context,
22+
pub _ctx: &'a Context,
2323
pub config: &'a Config,
2424
pub entry: &'a AuditLogEntry,
2525
pub executor: &'a User,
@@ -28,14 +28,14 @@ pub struct AuditLogContext<'a> {
2828

2929
impl<'a> AuditLogContext<'a> {
3030
pub fn new(
31-
ctx: &'a Context,
31+
_ctx: &'a Context,
3232
config: &'a Config,
3333
entry: &'a AuditLogEntry,
3434
executor: &'a User,
3535
guild_id: GuildId,
3636
) -> Self {
3737
Self {
38-
ctx,
38+
_ctx,
3939
config,
4040
entry,
4141
executor,
@@ -44,8 +44,15 @@ impl<'a> AuditLogContext<'a> {
4444
}
4545

4646
pub async fn translate(&self, key: &str, params: Option<&HashMap<String, String>>) -> String {
47-
get_translated_message(self.config, key, params, None, Some(self.guild_id.get()), None)
48-
.await
47+
get_translated_message(
48+
self.config,
49+
key,
50+
params,
51+
None,
52+
Some(self.guild_id.get()),
53+
None,
54+
)
55+
.await
4956
}
5057

5158
pub fn target_id(&self) -> Option<u64> {
@@ -103,7 +110,10 @@ pub trait AuditLogFormatter: Send + Sync {
103110
embed = embed.field(reason_label, reason, false);
104111
}
105112

106-
embed = embed.footer(CreateEmbedFooter::new(format!("ID: {}", alc.entry.id.get())));
113+
embed = embed.footer(CreateEmbedFooter::new(format!(
114+
"ID: {}",
115+
alc.entry.id.get()
116+
)));
107117

108118
embed
109119
}

0 commit comments

Comments
 (0)