Compare commits
No commits in common. "5ecfca061f1fec01ede553cf6e88bcec743f0e73" and "5996083274f836d25b05d5b70180dc015c5a99de" have entirely different histories.
5ecfca061f
...
5996083274
1 changed files with 2 additions and 33 deletions
|
@ -343,45 +343,14 @@ pub async fn admin_invitecode(
|
||||||
}
|
}
|
||||||
|
|
||||||
let active_codes = match list_invite_codes(nats.clone(), token.clone(), false).await {
|
let active_codes = match list_invite_codes(nats.clone(), token.clone(), false).await {
|
||||||
Ok(mut v) => {
|
Ok(v) => v,
|
||||||
for v in &mut v {
|
|
||||||
if let Some(used_by) = &v.used_by {
|
|
||||||
if used_by.len() > 32 {
|
|
||||||
v.used_by = Some(format!("{}...", &used_by[0..32]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.creator.len() > 32 {
|
|
||||||
v.creator = format!("{}...", &v.creator[0..32]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
v
|
|
||||||
},
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return e.into_response();
|
return e.into_response();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let used_codes = match list_invite_codes(nats.clone(), token.clone(), true).await {
|
let used_codes = match list_invite_codes(nats.clone(), token.clone(), true).await {
|
||||||
Ok(v) => v.into_iter().map(|mut v| {
|
Ok(v) => v.into_iter().map(|mut v| if v.used_at.is_none() { v.used_at = Some(String::from("unset")); v } else { v }).collect(),
|
||||||
if let Some(used_by) = &v.used_by {
|
|
||||||
if used_by.len() > 32 {
|
|
||||||
v.used_by = Some(format!("{}...", &used_by[0..32]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.creator.len() > 32 {
|
|
||||||
v.creator = format!("{}...", &v.creator[0..32]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.used_at.is_none() {
|
|
||||||
v.used_at = Some(String::from("unset"));
|
|
||||||
v
|
|
||||||
} else {
|
|
||||||
v
|
|
||||||
}
|
|
||||||
}).collect(),
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return e.into_response();
|
return e.into_response();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue