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

View File

@ -46,7 +46,7 @@ pub fn show(
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect(); let labels: Vec<String> = issue.labels().cloned().map(|t| t.into()).collect();
let assignees: Vec<String> = issue let assignees: Vec<String> = issue
.assigned() .assignees()
.map(|a| term::format::did(a).to_string()) .map(|a| term::format::did(a).to_string())
.collect(); .collect();
let author = issue.author(); 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())), "author": author(&issue.author(), aliases.alias(issue.author().id())),
"title": issue.title(), "title": issue.title(),
"state": issue.state(), "state": issue.state(),
"assignees": issue.assigned().collect::<Vec<_>>(), "assignees": issue.assignees().collect::<Vec<_>>(),
"discussion": issue "discussion": issue
.comments() .comments()
.map(|(id, comment)| Comment::new(id, comment, aliases)) .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() self.assignees.iter()
} }
@ -922,7 +922,7 @@ mod test {
let id = issue.id; let id = issue.id;
let issue = issues.get(&id).unwrap().unwrap(); 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_eq!(1, assignees.len());
assert!(assignees.contains(&assignee)); assert!(assignees.contains(&assignee));
@ -934,7 +934,7 @@ mod test {
let id = issue.id; let id = issue.id;
let issue = issues.get(&id).unwrap().unwrap(); 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_eq!(2, assignees.len());
assert!(assignees.contains(&assignee)); assert!(assignees.contains(&assignee));
@ -963,7 +963,7 @@ mod test {
issue.assign([assignee_two], &node.signer).unwrap(); issue.assign([assignee_two], &node.signer).unwrap();
issue.reload().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_eq!(1, assignees.len());
assert!(assignees.contains(&assignee_two)); assert!(assignees.contains(&assignee_two));
@ -971,7 +971,7 @@ mod test {
issue.assign([], &node.signer).unwrap(); issue.assign([], &node.signer).unwrap();
issue.reload().unwrap(); issue.reload().unwrap();
assert_eq!(0, issue.assigned().count()); assert_eq!(0, issue.assignees().count());
} }
#[test] #[test]
@ -1057,12 +1057,12 @@ mod test {
&node.signer, &node.signer,
) )
.unwrap(); .unwrap();
assert_eq!(2, issue.assigned().count()); assert_eq!(2, issue.assignees().count());
issue.assign([assignee_two], &node.signer).unwrap(); issue.assign([assignee_two], &node.signer).unwrap();
issue.reload().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_eq!(1, assignees.len());
assert!(assignees.contains(&assignee_two)); assert!(assignees.contains(&assignee_two));