(
&self,
mutation: &mut Mutation,
link: &RepoLink,
)
| 265 | } |
| 266 | |
| 267 | fn maybe_topic( |
| 268 | &self, |
| 269 | mutation: &mut Mutation, |
| 270 | link: &RepoLink, |
| 271 | ) -> Result<(Option<RepoTopic>, HashMap<ExternalId, RepoTopic>)> { |
| 272 | let mut parent_topics = HashMap::new(); |
| 273 | |
| 274 | for parent in &link.parent_topics { |
| 275 | if let Some(topic) = mutation.fetch_topic(self.repo_id, &parent.id) { |
| 276 | parent_topics.insert(parent.id.to_owned(), topic); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | let topic = if let Some(topic_id) = &self.add_parent_topic_id { |
| 281 | let topic = mutation.fetch_topic(self.repo_id, topic_id); |
| 282 | if let Some(topic) = &topic { |
| 283 | parent_topics.insert(topic_id.to_owned(), topic.to_owned()); |
| 284 | } else { |
| 285 | log::info!( |
| 286 | "no parent topic found in selected repo, creating reference: {}", |
| 287 | topic_id |
| 288 | ); |
| 289 | parent_topics.insert( |
| 290 | topic_id.to_owned(), |
| 291 | RepoTopic::make_reference(topic_id.to_owned()), |
| 292 | ); |
| 293 | } |
| 294 | topic |
| 295 | } else { |
| 296 | None |
| 297 | }; |
| 298 | |
| 299 | if parent_topics.is_empty() { |
| 300 | // There's a client error if we get to this point. |
| 301 | log::warn!("no topic found, placing under root topic"); |
| 302 | if let Some(topic) = mutation.fetch_topic(self.repo_id, &ExternalId::root_topic()) { |
| 303 | parent_topics.insert(topic.topic_id().to_owned(), topic); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | Ok((topic, parent_topics)) |
| 308 | } |
| 309 | |
| 310 | fn change( |
| 311 | &self, |
no test coverage detected