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

Method activity

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

Source from the content-addressed store, hash-verified

181#[Object]
182impl Topic {
183 async fn activity(
184 &self,
185 ctx: &Context<'_>,
186 after: Option<String>,
187 before: Option<String>,
188 first: Option<i32>,
189 last: Option<i32>,
190 ) -> Result<ActivityLineItemConnection> {
191 let topic_id = Some(self.0.key.0.to_owned());
192 let store = ctx.data_unchecked::<Store>();
193
194 let activity = store
195 .activity(RepoId::wiki(), &topic_id.to_owned(), first.unwrap_or(3))
196 .await?;
197
198 let mut results = vec![];
199 for change in activity {
200 let actor = store.user_loader.load_one(change.actor_id()).await?;
201 let actor_name = actor
202 .map(|user| user.name)
203 .unwrap_or_else(|| "[missing user]".to_owned());
204
205 results.push(ActivityLineItem {
206 created_at: change.date(),
207 description: change.markdown(Locale::EN, &actor_name, topic_id.as_ref()),
208 });
209 }
210
211 relay::connection(after, before, first, last, results).await
212 }
213
214 async fn children(
215 &self,

Callers

nothing calls this directly

Calls 4

connectionFunction · 0.85
actor_idMethod · 0.80
dateMethod · 0.80
markdownMethod · 0.80

Tested by

no test coverage detected