MCPcopy Index your code
hub / github.com/emwalker/digraph / call

Method call

backend/src/git/link.rs:27–62  ·  view source on GitHub ↗
(&self, mut mutation: Mutation, store: &S)

Source from the content-addressed store, hash-verified

25
26impl DeleteLink {
27 pub fn call<S>(&self, mut mutation: Mutation, store: &S) -> Result<DeleteLinkResult>
28 where
29 S: SaveChangesForPrefix,
30 {
31 let link = mutation.fetch_link(self.repo_id, &self.link_id);
32 if link.is_none() {
33 return Err(Error::NotFound(format!("not found: {}", self.link_id)));
34 }
35 let link = link.unwrap();
36
37 // Not actually used
38 let date = chrono::Utc::now();
39 let child = link.to_topic_child(date);
40 let mut parent_topics = vec![];
41
42 mutation.mark_deleted(self.repo_id, &self.link_id)?;
43
44 for ParentTopic { id: parent_id, .. } in &link.parent_topics {
45 if let Some(mut parent) = mutation.fetch_topic(self.repo_id, parent_id) {
46 parent.children.remove(&child);
47 mutation.save_topic(self.repo_id, &parent)?;
48 parent_topics.push(parent);
49 }
50 }
51
52 let change = self.change(&link, &parent_topics, date);
53
54 mutation.remove_link(self.repo_id, &self.link_id, &link)?;
55 mutation.add_change(self.repo_id, &change)?;
56 mutation.write(store)?;
57
58 Ok(DeleteLinkResult {
59 alerts: vec![],
60 deleted_link_id: self.link_id.clone(),
61 })
62 }
63
64 fn change(
65 &self,

Callers 15

activityMethod · 0.45
delete_accountMethod · 0.45
delete_linkMethod · 0.45
delete_sessionMethod · 0.45
delete_topicMethod · 0.45
repositories_for_userMethod · 0.45
searchMethod · 0.45
search_topicsMethod · 0.45
select_repositoryMethod · 0.45

Calls 15

parseFunction · 0.85
RepoClass · 0.85
to_topic_childMethod · 0.80
save_topicMethod · 0.80
remove_linkMethod · 0.80
insertMethod · 0.80
to_parent_topicMethod · 0.80
save_linkMethod · 0.80
make_linkMethod · 0.80
maybe_topicMethod · 0.80
fetch_linkMethod · 0.45
mark_deletedMethod · 0.45

Tested by 15

link_deletedFunction · 0.36
activity_log_updatedFunction · 0.36
topics_updatedFunction · 0.36
find_topicMethod · 0.36
upsert_linkMethod · 0.36
upsert_topicMethod · 0.36
update_simple_fixturesFunction · 0.36
topic_deletedFunction · 0.36
parent_topics_updatedFunction · 0.36
cannot_delete_root_topicFunction · 0.36
make_topicFunction · 0.36