diff --git a/src/routes/activitypub/context.rs b/src/routes/activitypub/context.rs index 7278018a..42422ea8 100644 --- a/src/routes/activitypub/context.rs +++ b/src/routes/activitypub/context.rs @@ -26,13 +26,7 @@ pub async fn page( Query(page): Query, AuthIdentity(auth): AuthIdentity, ) -> crate::Result> { - let context = if id.starts_with('+') { - id.replacen('+', "https://", 1).replace('@', "/") - } else if id.starts_with("tag:") { - id.clone() - } else { - url!(ctx, "/context/{id}") // TODO need a better way to figure out which ones are our contexts - }; + let context = ctx.context_id(&id); crate::server::builders::paginate( url!(ctx, "/context/{id}/page"), diff --git a/src/server/context.rs b/src/server/context.rs index 765d9371..20216227 100644 --- a/src/server/context.rs +++ b/src/server/context.rs @@ -121,6 +121,9 @@ impl Context { // TODO remove this!! pub fn context_id(&self, id: &str) -> String { + if id.starts_with("tag:") { + return id.to_string(); + } uriproxy::uri(self.base(), UriClass::Context, id) }