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

Method activity

backend/src/graphql/view.rs:33–68  ·  view source on GitHub ↗
(
        &self,
        ctx: &Context<'_>,
        after: Option<String>,
        before: Option<String>,
        first: Option<i32>,
        last: Option<i32>,
        topic_id: Option<String>,
    

Source from the content-addressed store, hash-verified

31#[Object]
32impl View {
33 async fn activity(
34 &self,
35 ctx: &Context<'_>,
36 after: Option<String>,
37 before: Option<String>,
38 first: Option<i32>,
39 last: Option<i32>,
40 topic_id: Option<String>,
41 ) -> Result<ActivityLineItemConnection> {
42 let store = ctx.data_unchecked::<Store>();
43 let repo_id = RepoId::wiki();
44 let topic_id: Option<ExternalId> = match topic_id {
45 Some(topic_id) => Some(topic_id.try_into()?),
46 None => None,
47 };
48
49 let activity = store
50 .activity(repo_id, &topic_id, first.unwrap_or(3))
51 .await?;
52
53 let mut results = vec![];
54 for change in activity {
55 let actor = store.user_loader.load_one(change.actor_id()).await?;
56 let actor_name = actor
57 .map(|user| user.name)
58 .unwrap_or_else(|| "[missing user]".to_owned());
59
60 let markdown = change.markdown(Locale::EN, &actor_name, None);
61 results.push(ActivityLineItem {
62 created_at: change.date(),
63 description: markdown,
64 });
65 }
66
67 relay::connection(after, before, first, last, results).await
68 }
69
70 async fn link(&self, ctx: &Context<'_>, id: String) -> Result<Option<Link>> {
71 Ok(ctx

Callers

nothing calls this directly

Calls 5

connectionFunction · 0.85
actor_idMethod · 0.80
markdownMethod · 0.80
dateMethod · 0.80
try_intoMethod · 0.45

Tested by

no test coverage detected