-/// Instance actor is at the root path, so we simply need to clear the path and other unnecessary
-/// parts of the url.
-pub fn instance_actor_id_from_url(mut url: Url) -> Url {
- url.set_fragment(None);
- url.set_path("");
- url.set_query(None);
- url
-}
-
-/// try to fetch the instance actor (to make things like instance rules available)
-pub(in crate::objects) async fn fetch_instance_actor_for_object(
- object_id: Url,
- context: &LemmyContext,
- request_counter: &mut i32,
-) {
- // try to fetch the instance actor (to make things like instance rules available)
- let instance_id = instance_actor_id_from_url(object_id);
- let site = ObjectId::<ApubSite>::new(instance_id.clone())
- .dereference(context, local_instance(context), request_counter)
+/// Try to fetch the instance actor (to make things like instance rules available).
+pub(in crate::objects) async fn fetch_instance_actor_for_object<T: Into<Url> + Clone>(
+ object_id: &T,
+ context: &Data<LemmyContext>,
+) -> Result<InstanceId, LemmyError> {
+ let object_id: Url = object_id.clone().into();
+ let instance_id = Site::instance_actor_id_from_url(object_id);
+ let site = ObjectId::<ApubSite>::from(instance_id.clone())
+ .dereference(context)