(
&self,
ctx: &Context<'_>,
after: Option<String>,
before: Option<String>,
first: Option<i32>,
last: Option<i32>,
topic_id: Option<String>,
| 31 | #[Object] |
| 32 | impl 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 |
nothing calls this directly
no test coverage detected