mirror of https://github.com/usbharu/Hideout.git
refactor: Hideoutユーザー側の設定もActivityPubと合わせるように
This commit is contained in:
parent
fe74d1e30b
commit
4e8cffdbe2
|
@ -3,6 +3,5 @@ package dev.usbharu.hideout.core.domain.model.userdetails
|
|||
data class UserDetail(
|
||||
val actorId: Long,
|
||||
val password: String,
|
||||
val autoAcceptFollowRequest: Boolean,
|
||||
val autoAcceptFolloweeFollowRequest: Boolean
|
||||
)
|
||||
|
|
|
@ -18,13 +18,11 @@ class UserDetailRepositoryImpl : UserDetailRepository {
|
|||
UserDetails.insert {
|
||||
it[actorId] = userDetail.actorId
|
||||
it[password] = userDetail.password
|
||||
it[autoAcceptFollowRequest] = userDetail.autoAcceptFollowRequest
|
||||
it[autoAcceptFolloweeFollowRequest] = userDetail.autoAcceptFolloweeFollowRequest
|
||||
}
|
||||
} else {
|
||||
UserDetails.update({ UserDetails.actorId eq userDetail.actorId }) {
|
||||
it[password] = userDetail.password
|
||||
it[autoAcceptFollowRequest] = userDetail.autoAcceptFollowRequest
|
||||
it[autoAcceptFolloweeFollowRequest] = userDetail.autoAcceptFolloweeFollowRequest
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +41,6 @@ class UserDetailRepositoryImpl : UserDetailRepository {
|
|||
UserDetail(
|
||||
it[UserDetails.actorId],
|
||||
it[UserDetails.password],
|
||||
it[UserDetails.autoAcceptFollowRequest],
|
||||
it[UserDetails.autoAcceptFolloweeFollowRequest]
|
||||
)
|
||||
}
|
||||
|
@ -55,6 +52,5 @@ class UserDetailRepositoryImpl : UserDetailRepository {
|
|||
object UserDetails : LongIdTable("user_details") {
|
||||
val actorId = long("actor_id").references(Actors.id)
|
||||
val password = varchar("password", 255)
|
||||
val autoAcceptFollowRequest = bool("auto_accept_follow_request")
|
||||
val autoAcceptFolloweeFollowRequest = bool("auto_accept_followee_follow_request")
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ data class UpdateUserDto(
|
|||
val description: String,
|
||||
val avatarMedia: Media?,
|
||||
val headerMedia: Media?,
|
||||
val autoAcceptFollowRequest: Boolean,
|
||||
val locked: Boolean,
|
||||
val autoAcceptFolloweeFollowRequest: Boolean
|
||||
)
|
||||
|
|
|
@ -53,7 +53,7 @@ class UserServiceImpl(
|
|||
locked = false
|
||||
)
|
||||
val save = actorRepository.save(userEntity)
|
||||
userDetailRepository.save(UserDetail(nextId, hashedPassword, true, true))
|
||||
userDetailRepository.save(UserDetail(nextId, hashedPassword, true))
|
||||
return save
|
||||
}
|
||||
|
||||
|
@ -106,12 +106,12 @@ class UserServiceImpl(
|
|||
actor.copy(
|
||||
screenName = updateUserDto.screenName,
|
||||
description = updateUserDto.description,
|
||||
locked = updateUserDto.locked
|
||||
)
|
||||
)
|
||||
|
||||
userDetailRepository.save(
|
||||
userDetail.copy(
|
||||
autoAcceptFollowRequest = updateUserDto.autoAcceptFollowRequest,
|
||||
autoAcceptFolloweeFollowRequest = updateUserDto.autoAcceptFolloweeFollowRequest
|
||||
)
|
||||
)
|
||||
|
|
|
@ -195,7 +195,7 @@ class AccountApiServiceImpl(
|
|||
description = updateCredentials?.note ?: account.note,
|
||||
avatarMedia = avatarMedia,
|
||||
headerMedia = headerMedia,
|
||||
autoAcceptFollowRequest = updateCredentials?.locked ?: account.locked,
|
||||
locked = updateCredentials?.locked ?: account.locked,
|
||||
autoAcceptFolloweeFollowRequest = false
|
||||
)
|
||||
userService.updateUser(userid, updateUserDto)
|
||||
|
|
|
@ -40,7 +40,6 @@ create table if not exists user_details
|
|||
id bigserial primary key,
|
||||
actor_id bigint not null unique,
|
||||
password varchar(255) not null,
|
||||
auto_accept_follow_request boolean not null,
|
||||
auto_accept_followee_follow_request boolean not null,
|
||||
constraint fk_user_details_actor_id__id foreign key (actor_id) references actors (id) on delete restrict on update restrict
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue