(
&self,
mutation: Mutation,
parent: RepoTopic,
matches: BTreeSet<SynonymMatch>,
)
| 573 | } |
| 574 | |
| 575 | fn request_decision( |
| 576 | &self, |
| 577 | mutation: Mutation, |
| 578 | parent: RepoTopic, |
| 579 | matches: BTreeSet<SynonymMatch>, |
| 580 | ) -> Result<UpsertTopicResult> { |
| 581 | log::info!("topic '{}' exists and OnMatchingSynonym::Ask", self.name); |
| 582 | |
| 583 | let alert = Alert::Success(format!( |
| 584 | r#"One or more existing topics with a synonym of "{}" were found. Would you like to |
| 585 | add one of the matching topics to the parent topic we're looking at, or would you like |
| 586 | to create a new subtopic with the same name?"#, |
| 587 | self.name |
| 588 | )); |
| 589 | |
| 590 | let parent_id = &parent.topic_id(); |
| 591 | let mut matching_repo_topics: BTreeSet<SynonymMatch> = BTreeSet::new(); |
| 592 | |
| 593 | for synonym_match in matches { |
| 594 | let topic_id = &synonym_match.repo_topic.topic_id(); |
| 595 | if mutation.cycle_exists(self.repo_id, topic_id, parent_id)? { |
| 596 | matching_repo_topics.insert(synonym_match.with_cycle(true)); |
| 597 | } else { |
| 598 | matching_repo_topics.insert(synonym_match); |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | Ok(UpsertTopicResult { |
| 603 | alerts: vec![alert], |
| 604 | matching_repo_topics, |
| 605 | repo_topic: None, |
| 606 | saved: false, |
| 607 | }) |
| 608 | } |
| 609 | |
| 610 | fn add_repo_topic<S>( |
| 611 | &self, |
no test coverage detected