mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-16 00:10:38 +08:00
bin/ui: Simplify impl of ui::format::assignees()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
committed by
Erik Kundt
parent
8aeffe61ff
commit
d52dca76b6
+7
-13
@@ -76,17 +76,11 @@ pub fn author(did: &Did, alias: &Option<Alias>, is_you: bool) -> String {
|
||||
}
|
||||
|
||||
pub fn assignees(assignees: &[(Option<PublicKey>, Option<Alias>, bool)]) -> String {
|
||||
let mut output = String::new();
|
||||
let mut assignees = assignees.iter().peekable();
|
||||
|
||||
while let Some((assignee, alias, is_you)) = assignees.next() {
|
||||
if let Some(assignee) = assignee {
|
||||
output.push_str(&self::author(&Did::from(assignee), alias, *is_you));
|
||||
}
|
||||
|
||||
if assignees.peek().is_some() {
|
||||
output.push(',');
|
||||
}
|
||||
}
|
||||
output
|
||||
assignees
|
||||
.iter()
|
||||
.flat_map(|(assignee, alias, is_you)| {
|
||||
assignee.map(|a| self::author(&Did::from(a), alias, *is_you))
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(",")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user