radicle: rename Issue::assigned -> Issue::assignees

Align the naming with the field itself and Patch::assignees.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny 2023-11-30 17:27:32 +00:00 committed by cloudhead
parent 3e07808ee5
commit dce5316cbb
No known key found for this signature in database
5 changed files with 12 additions and 12 deletions

View File

@ -510,7 +510,7 @@ fn list<R: WriteRepository + cob::Store>(
};
if let Some(a) = assignee {
if !issue.assigned().any(|v| v == &Did::from(a)) {
if !issue.assignees().any(|v| v == &Did::from(a)) {
continue;
}
}
@ -544,7 +544,7 @@ fn list<R: WriteRepository + cob::Store>(
for (id, issue) in all {
let assigned: String = issue
.assigned()
.assignees()
.map(|did| {
let (alias, _) = Author::new(did.as_key(), profile).labels();

View File

@ -87,7 +87,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
})?;
let signer = term::signer(&profile)?;
let assigned = issue
.assigned()
.assignees()
.cloned()
.filter(|did| !options.from.contains(did))
.collect::<Vec<_>>();

View File

@ -46,7 +46,7 @@ pub fn show(
) -> anyhow::Result<()> {
let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect();
let assignees: Vec<String> = issue
.assigned()
.assignees()
.map(|a| term::format::did(a).to_string())
.collect();
let author = issue.author();

View File

@ -105,7 +105,7 @@ pub(crate) fn issue(id: IssueId, issue: Issue, aliases: &impl AliasStore) -> Val
"author": author(&issue.author(), aliases.alias(issue.author().id())),
"title": issue.title(),
"state": issue.state(),
"assignees": issue.assigned().collect::<Vec<_>>(),
"assignees": issue.assignees().collect::<Vec<_>>(),
"discussion": issue
.comments()
.map(|(id, comment)| Comment::new(id, comment, aliases))

View File

@ -197,7 +197,7 @@ impl Issue {
}
}
pub fn assigned(&self) -> impl Iterator<Item = &Did> + '_ {
pub fn assignees(&self) -> impl Iterator<Item = &Did> + '_ {
self.assignees.iter()
}
@ -922,7 +922,7 @@ mod test {
let id = issue.id;
let issue = issues.get(&id).unwrap().unwrap();
let assignees: Vec<_> = issue.assigned().cloned().collect::<Vec<_>>();
let assignees: Vec<_> = issue.assignees().cloned().collect::<Vec<_>>();
assert_eq!(1, assignees.len());
assert!(assignees.contains(&assignee));
@ -934,7 +934,7 @@ mod test {
let id = issue.id;
let issue = issues.get(&id).unwrap().unwrap();
let assignees: Vec<_> = issue.assigned().cloned().collect::<Vec<_>>();
let assignees: Vec<_> = issue.assignees().cloned().collect::<Vec<_>>();
assert_eq!(2, assignees.len());
assert!(assignees.contains(&assignee));
@ -963,7 +963,7 @@ mod test {
issue.assign([assignee_two], &node.signer).unwrap();
issue.reload().unwrap();
let assignees: Vec<_> = issue.assigned().cloned().collect::<Vec<_>>();
let assignees: Vec<_> = issue.assignees().cloned().collect::<Vec<_>>();
assert_eq!(1, assignees.len());
assert!(assignees.contains(&assignee_two));
@ -971,7 +971,7 @@ mod test {
issue.assign([], &node.signer).unwrap();
issue.reload().unwrap();
assert_eq!(0, issue.assigned().count());
assert_eq!(0, issue.assignees().count());
}
#[test]
@ -1057,12 +1057,12 @@ mod test {
&node.signer,
)
.unwrap();
assert_eq!(2, issue.assigned().count());
assert_eq!(2, issue.assignees().count());
issue.assign([assignee_two], &node.signer).unwrap();
issue.reload().unwrap();
let assignees: Vec<_> = issue.assigned().cloned().collect::<Vec<_>>();
let assignees: Vec<_> = issue.assignees().cloned().collect::<Vec<_>>();
assert_eq!(1, assignees.len());
assert!(assignees.contains(&assignee_two));