feat: フォロー承認制ユーザーかの情報をActivityPub側でも持たせるように

This commit is contained in:
usbharu 2023-12-12 01:32:55 +09:00
parent 6b535a042a
commit fe74d1e30b
26 changed files with 98 additions and 63 deletions

View File

@ -1,5 +1,5 @@
insert into actors (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (1730415786666758144, 'test-user', 'localhost', 'Im test user.', 'THis account is test user.',
'http://localhost/users/test-user/inbox',
'http://localhost/users/test-user/outbox', 'http://localhost/users/test-user',
@ -43,7 +43,7 @@ Ja15+ZWbOA4vJA9pOh3x4XM=
-----END PRIVATE KEY-----
', 1701398248417,
'http://localhost/users/test-user#pubkey', 'http://localhost/users/test-user/following',
'http://localhost/users/test-users/followers', null);
'http://localhost/users/test-users/followers', null, false);
insert into user_details (actor_id, password, auto_accept_follow_request, auto_accept_followee_follow_request)
values ( 1730415786666758144

View File

@ -1,16 +1,16 @@
insert into "actors" (id, name, domain, screen_name, description, inbox, outbox, url, public_key, private_key,
created_at, key_id, following, followers, instance)
created_at, key_id, following, followers, instance, locked)
VALUES (3733363, 'follow-test-user-1', 'example.com', 'follow-test-user-1-name', '',
'https://example.com/users/follow-test-user-1/inbox',
'https://example.com/users/follow-test-user-1/outbox', 'https://example.com/users/follow-test-user-1',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/follow-test-user-1#pubkey', 'https://example.com/users/follow-test-user-1/following',
'https://example.com/users/follow-test-user-1/followers', null),
'https://example.com/users/follow-test-user-1/followers', null, false),
(37335363, 'follow-test-user-2', 'example.com', 'follow-test-user-2-name', '',
'https://example.com/users/follow-test-user-2/inbox',
'https://example.com/users/follow-test-user-2/outbox', 'https://example.com/users/follow-test-user-2',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/follow-test-user-2#pubkey', 'https://example.com/users/follow-test-user-2/following',
'https://example.com/users/follow-test-user-2/followers', null);
'https://example.com/users/follow-test-user-2/followers', null, false);

View File

@ -1,23 +1,20 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (8, 'test-user8', 'example.com', 'Im test-user8.', 'THis account is test-user8.',
'https://example.com/users/test-user8/inbox',
'https://example.com/users/test-user8/outbox', 'https://example.com/users/test-user8',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user8#pubkey', 'https://example.com/users/test-user8/following',
'https://example.com/users/test-user8/followers', null);
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
VALUES (9, 'test-user9', 'follower.example.com', 'Im test-user9.', 'THis account is test-user9.',
'https://example.com/users/test-user8/followers', null, false),
(9, 'test-user9', 'follower.example.com', 'Im test-user9.', 'THis account is test-user9.',
'https://follower.example.com/users/test-user9/inbox',
'https://follower.example.com/users/test-user9/outbox', 'https://follower.example.com/users/test-user9',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
null, 12345678,
'https://follower.example.com/users/test-user9#pubkey',
'https://follower.example.com/users/test-user9/following',
'https://follower.example.com/users/test-user9/followers', null);
'https://follower.example.com/users/test-user9/followers', null, false);
insert into relationships (actor_id, target_actor_id, following, blocking, muting, follow_request,
ignore_follow_request)

View File

@ -1,24 +1,20 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (4, 'test-user4', 'example.com', 'Im test user4.', 'THis account is test user4.',
'https://example.com/users/test-user4/inbox',
'https://example.com/users/test-user4/outbox', 'https://example.com/users/test-user4',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user4#pubkey', 'https://example.com/users/test-user4/following',
'https://example.com/users/test-user4/followers', null);
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
VALUES (5, 'test-user5', 'follower.example.com', 'Im test user5.', 'THis account is test user5.',
'https://example.com/users/test-user4/followers', null, false),
(5, 'test-user5', 'follower.example.com', 'Im test user5.', 'THis account is test user5.',
'https://follower.example.com/users/test-user5/inbox',
'https://follower.example.com/users/test-user5/outbox', 'https://follower.example.com/users/test-user5',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
null, 12345678,
'https://follower.example.com/users/test-user5#pubkey',
'https://follower.example.com/users/test-user5/following',
'https://follower.example.com/users/test-user5/followers', null);
'https://follower.example.com/users/test-user5/followers', null, false);
insert into relationships (actor_id, target_actor_id, following, blocking, muting, follow_request,
ignore_follow_request)

View File

@ -1,23 +1,20 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (6, 'test-user6', 'example.com', 'Im test-user6.', 'THis account is test-user6.',
'https://example.com/users/test-user6/inbox',
'https://example.com/users/test-user6/outbox', 'https://example.com/users/test-user6',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user6#pubkey', 'https://example.com/users/test-user6/following',
'https://example.com/users/test-user6/followers', null);
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
VALUES (7, 'test-user7', 'follower.example.com', 'Im test-user7.', 'THis account is test-user7.',
'https://example.com/users/test-user6/followers', null, false),
(7, 'test-user7', 'follower.example.com', 'Im test-user7.', 'THis account is test-user7.',
'https://follower.example.com/users/test-user7/inbox',
'https://follower.example.com/users/test-user7/outbox', 'https://follower.example.com/users/test-user7',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
null, 12345678,
'https://follower.example.com/users/test-user7#pubkey',
'https://follower.example.com/users/test-user7/following',
'https://follower.example.com/users/test-user7/followers', null);
'https://follower.example.com/users/test-user7/followers', null, false);
insert into relationships (actor_id, target_actor_id, following, blocking, muting, follow_request,
ignore_follow_request)

View File

@ -1,12 +1,12 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (11, 'test-user11', 'example.com', 'Im test-user11.', 'THis account is test-user11.',
'https://example.com/users/test-user11/inbox',
'https://example.com/users/test-user11/outbox', 'https://example.com/users/test-user11',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user11#pubkey', 'https://example.com/users/test-user11/following',
'https://example.com/users/test-user11/followers', null);
'https://example.com/users/test-user11/followers', null, false);
insert into POSTS (ID, actor_id, OVERVIEW, TEXT, "CREATED_AT", VISIBILITY, URL, "REPOST_ID", "REPLY_ID", SENSITIVE,
AP_ID)

View File

@ -1,12 +1,12 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (10, 'test-user10', 'example.com', 'Im test-user10.', 'THis account is test-user10.',
'https://example.com/users/test-user10/inbox',
'https://example.com/users/test-user10/outbox', 'https://example.com/users/test-user10',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user10#pubkey', 'https://example.com/users/test-user10/following',
'https://example.com/users/test-user10/followers', null);
'https://example.com/users/test-user10/followers', null, false);
insert into POSTS (ID, actor_id, OVERVIEW, TEXT, "CREATED_AT", VISIBILITY, URL, "REPOST_ID", "REPLY_ID", SENSITIVE,
AP_ID)

View File

@ -1,12 +1,12 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (3, 'test-user3', 'example.com', 'Im test user3.', 'THis account is test user3.',
'https://example.com/users/test-user3/inbox',
'https://example.com/users/test-user3/outbox', 'https://example.com/users/test-user3',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user3#pubkey', 'https://example.com/users/test-user3/following',
'https://example.com/users/test-user3/followers', null);
'https://example.com/users/test-user3/followers', null, false);
insert into POSTS (ID, actor_id, OVERVIEW, TEXT, "CREATED_AT", VISIBILITY, URL, "REPOST_ID", "REPLY_ID", SENSITIVE,
AP_ID)

View File

@ -1,12 +1,12 @@
insert into actors (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (1, 'test-user', 'example.com', 'Im test user.', 'THis account is test user.',
'https://example.com/users/test-user/inbox',
'https://example.com/users/test-user/outbox', 'https://example.com/users/test-user',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user#pubkey', 'https://example.com/users/test-user/following',
'https://example.com/users/test-users/followers', null);
'https://example.com/users/test-users/followers', null, false);
insert into POSTS (ID, actor_id, OVERVIEW, TEXT, "CREATED_AT", VISIBILITY, URL, "REPOST_ID", "REPLY_ID", SENSITIVE,
AP_ID)

View File

@ -1,12 +1,12 @@
insert into actors (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (2, 'test-user2', 'example.com', 'Im test user2.', 'THis account is test user2.',
'https://example.com/users/test-user2/inbox',
'https://example.com/users/test-user2/outbox', 'https://example.com/users/test-user2',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user2#pubkey', 'https://example.com/users/test-user2/following',
'https://example.com/users/test-user2/followers', null);
'https://example.com/users/test-user2/followers', null, false);
insert into POSTS (ID, actor_id, OVERVIEW, TEXT, "CREATED_AT", VISIBILITY, URL, "REPOST_ID", "REPLY_ID", SENSITIVE,
AP_ID)

View File

@ -1,9 +1,9 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (1, 'test-user', 'example.com', 'Im test user.', 'THis account is test user.',
'https://example.com/users/test-user/inbox',
'https://example.com/users/test-user/outbox', 'https://example.com/users/test-user',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user#pubkey', 'https://example.com/users/test-user/following',
'https://example.com/users/test-users/followers', null);
'https://example.com/users/test-users/followers', null, false);

View File

@ -1,9 +1,9 @@
insert into "actors" (ID, NAME, DOMAIN, SCREEN_NAME, DESCRIPTION, INBOX, OUTBOX, URL, PUBLIC_KEY, PRIVATE_KEY,
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE)
CREATED_AT, KEY_ID, FOLLOWING, FOLLOWERS, INSTANCE, LOCKED)
VALUES (2, 'test-user2', 'example.com', 'Im test user.', 'THis account is test user.',
'https://example.com/users/test-user2/inbox',
'https://example.com/users/test-user2/outbox', 'https://example.com/users/test-user2',
'-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----',
'-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----', 12345678,
'https://example.com/users/test-user2#pubkey', 'https://example.com/users/test-user2/following',
'https://example.com/users/test-user2s/followers', null);
'https://example.com/users/test-user2s/followers', null, false);

View File

@ -17,10 +17,10 @@ constructor(
var publicKey: Key,
var endpoints: Map<String, String> = emptyMap(),
var followers: String?,
var following: String?
var following: String?,
val manuallyApprovesFollowers: Boolean? = false
) : Object(add(type, "Person")), HasId, HasName {
@Suppress("CyclomaticComplexMethod", "CognitiveComplexMethod")
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@ -40,11 +40,11 @@ constructor(
if (endpoints != other.endpoints) return false
if (followers != other.followers) return false
if (following != other.following) return false
if (manuallyApprovesFollowers != other.manuallyApprovesFollowers) return false
return true
}
@Suppress("CyclomaticComplexMethod")
override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + name.hashCode()
@ -59,6 +59,26 @@ constructor(
result = 31 * result + endpoints.hashCode()
result = 31 * result + (followers?.hashCode() ?: 0)
result = 31 * result + (following?.hashCode() ?: 0)
result = 31 * result + manuallyApprovesFollowers.hashCode()
return result
}
override fun toString(): String {
return "Person(" +
"name='$name', " +
"id='$id', " +
"preferredUsername=$preferredUsername, " +
"summary=$summary, " +
"inbox='$inbox', " +
"outbox='$outbox', " +
"url='$url', " +
"icon=$icon, " +
"publicKey=$publicKey, " +
"endpoints=$endpoints, " +
"followers=$followers, " +
"following=$following, " +
"manuallyApprovesFollowers=$manuallyApprovesFollowers" +
")" +
" ${super.toString()}"
}
}

View File

@ -68,7 +68,8 @@ class APUserServiceImpl(
),
endpoints = mapOf("sharedInbox" to "${applicationConfig.url}/inbox"),
followers = userEntity.followers,
following = userEntity.following
following = userEntity.following,
manuallyApprovesFollowers = userEntity.locked
)
}
@ -104,7 +105,8 @@ class APUserServiceImpl(
keyId = person.publicKey.id,
following = person.following,
followers = person.followers,
sharedInbox = person.endpoints["sharedInbox"]
sharedInbox = person.endpoints["sharedInbox"],
locked = person.manuallyApprovesFollowers
)
)
}
@ -134,6 +136,7 @@ class APUserServiceImpl(
),
endpoints = mapOf("sharedInbox" to "${applicationConfig.url}/inbox"),
followers = actorEntity.followers,
following = actorEntity.following
following = actorEntity.following,
manuallyApprovesFollowers = actorEntity.locked
)
}

View File

@ -21,7 +21,8 @@ data class Actor private constructor(
val keyId: String,
val followers: String? = null,
val following: String? = null,
val instance: Long? = null
val instance: Long? = null,
val locked: Boolean
) {
@ -46,7 +47,8 @@ data class Actor private constructor(
keyId: String,
following: String? = null,
followers: String? = null,
instance: Long? = null
instance: Long? = null,
locked: Boolean
): Actor {
// idは0未満ではいけない
require(id >= 0) { "id must be greater than or equal to 0." }
@ -137,7 +139,8 @@ data class Actor private constructor(
keyId = keyId,
followers = followers,
following = following,
instance = instance
instance = instance,
locked
)
}
}
@ -158,7 +161,10 @@ data class Actor private constructor(
"keyId='$keyId', " +
"followers=$followers, " +
"following=$following, " +
"instance=$instance" +
"instance=$instance, " +
"locked=$locked" +
")"
}
}

View File

@ -25,7 +25,8 @@ class UserResultRowMapper(private val actorBuilder: Actor.UserBuilder) : ResultR
keyId = resultRow[Actors.keyId],
followers = resultRow[Actors.followers],
following = resultRow[Actors.following],
instance = resultRow[Actors.instance]
instance = resultRow[Actors.instance],
locked = resultRow[Actors.locked]
)
}
}

View File

@ -34,6 +34,7 @@ class ActorRepositoryImpl(
it[following] = actor.following
it[followers] = actor.followers
it[instance] = actor.instance
it[locked] = actor.locked
}
} else {
Actors.update({ Actors.id eq actor.id }) {
@ -51,6 +52,7 @@ class ActorRepositoryImpl(
it[following] = actor.following
it[followers] = actor.followers
it[instance] = actor.instance
it[locked] = actor.locked
}
}
return actor
@ -88,6 +90,7 @@ object Actors : Table("actors") {
val following = varchar("following", length = 1000).nullable()
val followers = varchar("followers", length = 1000).nullable()
val instance = long("instance").references(Instance.id).nullable()
val locked = bool("locked")
override val primaryKey: PrimaryKey = PrimaryKey(id)

View File

@ -12,5 +12,6 @@ data class RemoteUserCreateDto(
val keyId: String,
val followers: String?,
val following: String?,
val sharedInbox: String?
val sharedInbox: String?,
val locked: Boolean?
)

View File

@ -49,7 +49,8 @@ class UserServiceImpl(
createdAt = Instant.now(),
following = "$userUrl/following",
followers = "$userUrl/followers",
keyId = "$userUrl#pubkey"
keyId = "$userUrl#pubkey",
locked = false
)
val save = actorRepository.save(userEntity)
userDetailRepository.save(UserDetail(nextId, hashedPassword, true, true))
@ -82,7 +83,8 @@ class UserServiceImpl(
followers = user.followers,
following = user.following,
keyId = user.keyId,
instance = instance?.id
instance = instance?.id,
locked = user.locked ?: false
)
return try {
val save = actorRepository.save(userEntity)

View File

@ -30,6 +30,7 @@ create table if not exists actors
"following" varchar(1000) null,
followers varchar(1000) null,
"instance" bigint null,
locked boolean not null,
unique ("name", "domain"),
constraint fk_actors_instance__id foreign key ("instance") references instance (id) on delete restrict on update restrict
);

View File

@ -59,7 +59,8 @@ class ActorAPControllerImplTest {
),
endpoints = mapOf("sharedInbox" to "https://example.com/inbox"),
followers = "https://example.com/users/hoge/followers",
following = "https://example.com/users/hoge/following"
following = "https://example.com/users/hoge/following",
manuallyApprovesFollowers = false
)
whenever(apUserService.getPersonByName(eq("hoge"))).doReturn(person)

View File

@ -133,6 +133,7 @@ class APNoteServiceImplTest {
endpoints = mapOf("sharedInbox" to "https://example.com/inbox"),
followers = user.followers,
following = user.following,
manuallyApprovesFollowers = false
)
val apUserService = mock<APUserService> {

View File

@ -79,7 +79,8 @@ class ActorServiceTest {
keyId = "a",
following = "",
followers = "",
sharedInbox = null
sharedInbox = null,
locked = false
)
userService.createRemoteUser(user)
verify(actorRepository, times(1)).save(any())

View File

@ -1,8 +1,8 @@
package dev.usbharu.hideout.mastodon.interfaces.api.account
import dev.usbharu.hideout.application.config.ActivityPubConfig
import dev.usbharu.hideout.domain.mastodon.model.generated.AccountSource
import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccount
import dev.usbharu.hideout.domain.mastodon.model.generated.CredentialAccountSource
import dev.usbharu.hideout.domain.mastodon.model.generated.Role
import dev.usbharu.hideout.mastodon.service.account.AccountApiService
import kotlinx.coroutines.test.runTest
@ -74,10 +74,10 @@ class MastodonAccountApiControllerTest {
lastStatusAt = "",
statusesCount = 0,
followersCount = 0,
source = CredentialAccountSource(
source = AccountSource(
note = "",
fields = emptyList(),
privacy = CredentialAccountSource.Privacy.public,
privacy = AccountSource.Privacy.public,
sensitive = false,
followRequestsCount = 0
),

View File

@ -4,6 +4,7 @@ import dev.usbharu.hideout.application.external.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.domain.model.relationship.RelationshipRepository
import dev.usbharu.hideout.core.query.FollowerQueryService
import dev.usbharu.hideout.core.service.media.MediaService
import dev.usbharu.hideout.core.service.relationship.RelationshipService
import dev.usbharu.hideout.core.service.user.UserService
import dev.usbharu.hideout.domain.mastodon.model.generated.Account
@ -48,6 +49,9 @@ class AccountApiServiceImplTest {
@Mock
private lateinit var relationshipRepository: RelationshipRepository
@Mock
private lateinit var mediaService: MediaService
@InjectMocks
private lateinit var accountApiServiceImpl: AccountApiServiceImpl

View File

@ -19,7 +19,6 @@ object UserBuilder {
domain: String = "example.com",
screenName: String = name,
description: String = "This user is test user.",
password: String = "password-$id",
inbox: String = "https://$domain/users/$id/inbox",
outbox: String = "https://$domain/users/$id/outbox",
url: String = "https://$domain/users/$id",
@ -44,7 +43,8 @@ object UserBuilder {
createdAt = createdAt,
keyId = keyId,
followers = followers,
following = following
following = following,
locked = false
)
}
@ -77,7 +77,8 @@ object UserBuilder {
createdAt = createdAt,
keyId = keyId,
followers = followers,
following = following
following = following,
locked = false
)
}