(
&self,
mutation: Mutation,
store: &S,
name: String,
topic_id: &ExternalId,
parent: RepoTopic,
matches: BTreeSet<SynonymMatch>,
)
| 658 | } |
| 659 | |
| 660 | fn update_repo_topic<S>( |
| 661 | &self, |
| 662 | mutation: Mutation, |
| 663 | store: &S, |
| 664 | name: String, |
| 665 | topic_id: &ExternalId, |
| 666 | parent: RepoTopic, |
| 667 | matches: BTreeSet<SynonymMatch>, |
| 668 | ) -> Result<UpsertTopicResult> |
| 669 | where |
| 670 | S: SaveChangesForPrefix, |
| 671 | { |
| 672 | let date = chrono::Utc::now(); |
| 673 | |
| 674 | if mutation.cycle_exists(self.repo_id, topic_id, parent.topic_id())? { |
| 675 | return self.handle_cycle(mutation, topic_id, parent, matches); |
| 676 | } |
| 677 | |
| 678 | log::info!("updating existing topic {:?}", topic_id); |
| 679 | let mut topic = self.ensure_topic(&mutation, topic_id); |
| 680 | let parent_topics = topic.parent_topics.clone(); |
| 681 | |
| 682 | topic.parent_topics.insert(parent.to_parent_topic()); |
| 683 | topic = append_synonym(topic, &name, self.locale, date); |
| 684 | self.persist_repo_topic(mutation, store, topic, parent, parent_topics) |
| 685 | } |
| 686 | |
| 687 | fn handle_cycle( |
| 688 | &self, |
no test coverage detected