From 725f2fde72df4bdd92a2262fbb335f40e0a81a1c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Dec 2022 20:40:59 +0300 Subject: Extract profile URI helpers into ProfileUriBuilder --- .../api/activity/converters/UserToActorConverter.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/juick/www/api/activity/converters') diff --git a/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java b/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java index 405c27ab..435cb50d 100644 --- a/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java +++ b/src/main/java/com/juick/www/api/activity/converters/UserToActorConverter.java @@ -1,8 +1,8 @@ package com.juick.www.api.activity.converters; +import com.juick.www.api.activity.helpers.ProfileUriBuilder; import org.springframework.core.convert.converter.Converter; -import com.juick.ActivityPubManager; import com.juick.KeystoreManager; import com.juick.model.User; import com.juick.www.WebApp; @@ -18,15 +18,15 @@ import lombok.AllArgsConstructor; @AllArgsConstructor public class UserToActorConverter implements Converter { - private ActivityPubManager activityPubManager; + private ProfileUriBuilder profileUriBuilder; private KeystoreManager keystoreManager; private WebApp webApp; @Override public Actor convert(User user) { Actor profile = user.isService() ? new Application() : new Person(); - profile.setId(activityPubManager.personUri(user)); - profile.setUrl(activityPubManager.personWebUri(user)); + profile.setId(profileUriBuilder.personUri(user)); + profile.setUrl(profileUriBuilder.personWebUri(user)); profile.setName(user.getName()); profile.setPreferredUsername(user.getName()); Key publicKey = new Key(); @@ -34,10 +34,10 @@ public class UserToActorConverter implements Converter { publicKey.setOwner(profile.getId()); publicKey.setPublicKeyPem(keystoreManager.getPublicKeyPem()); profile.setPublicKey(publicKey); - profile.setInbox(activityPubManager.inboxUri()); - profile.setOutbox(activityPubManager.outboxUri(user)); - profile.setFollowers(activityPubManager.followersUri(user)); - profile.setFollowing(activityPubManager.followingUri(user)); + profile.setInbox(profileUriBuilder.inboxUri()); + profile.setOutbox(profileUriBuilder.outboxUri(user)); + profile.setFollowers(profileUriBuilder.followersUri(user)); + profile.setFollowing(profileUriBuilder.followingUri(user)); Image avatar = new Image(); avatar.setUrl(webApp.getAvatarUrl(user)); avatar.setMediaType("image/png"); -- cgit v1.2.3