spec(User): モデレーターは非公開ロールを確認できるように (MisskeyIO#384)

This commit is contained in:
まっちゃとーにゅ 2024-01-26 00:10:24 +09:00 committed by GitHub
parent 44b9dfd494
commit 0b6e22b8d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 41 additions and 18 deletions

View File

@ -586,7 +586,8 @@ deleteAllFilesConfirm: "Are you sure that you want to delete all files?"
removeAllFollowing: "Unfollow all followed users"
removeAllFollowingDescription: "Executing this unfollows all accounts from {host}. Please run this if the instance e.g. no longer exists."
userSuspended: "This user has been suspended."
userSilenced: "This user is being silenced."
userLimited: "This user has been limited."
userSilenced: "This user has been silenced."
yourAccountSuspendedTitle: "This account is suspended"
yourAccountSuspendedDescription: "This account has been suspended due to breaking the server's terms of services or similar. Contact the administrator if you would like to know a more detailed reason. Please do not create a new account."
tokenRevoked: "Invalid token"

4
locales/index.d.ts vendored
View File

@ -2388,6 +2388,10 @@ export interface Locale extends ILocale {
*
*/
"userSuspended": string;
/**
*
*/
"userLimited": string;
/**
*
*/

View File

@ -593,6 +593,7 @@ deleteAllFilesConfirm: "すべてのファイルを削除しますか?"
removeAllFollowing: "フォローを全解除"
removeAllFollowingDescription: "{host}からのフォローをすべて解除します。そのサーバーがもう存在しなくなった場合などに実行してください。"
userSuspended: "このユーザーは凍結されています。"
userLimited: "このユーザーは制限されています。"
userSilenced: "このユーザーはサイレンスされています。"
yourAccountSuspendedTitle: "アカウントが凍結されています"
yourAccountSuspendedDescription: "このアカウントは、サーバーの利用規約に違反したなどの理由により、凍結されています。詳細については管理者までお問い合わせください。新しいアカウントを作らないでください。"

View File

@ -592,6 +592,7 @@ deleteAllFilesConfirm: "모든 파일을 삭제하시겠습니까?"
removeAllFollowing: "모든 팔로잉 해제"
removeAllFollowingDescription: "{host} 서버의 모든 팔로잉을 해제합니다. 해당 서버가 더 이상 존재하지 않는 경우 등에 실행해 주세요."
userSuspended: "이 계정은 정지된 상태입니다."
userLimited: "이 계정은 제한된 상태입니다."
userSilenced: "이 계정은 사일런스된 상태입니다."
yourAccountSuspendedTitle: "계정이 정지되었습니다"
yourAccountSuspendedDescription: "이 계정은 서버의 이용 약관을 위반하거나, 기타 다른 이유로 인해 정지되었습니다. 자세한 사항은 관리자에게 문의해 주십시오. 계정을 새로 생성하지 마십시오."

View File

@ -343,9 +343,9 @@ export class UserEntityService implements OnModuleInit {
(profile.followersVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount :
null;
const isModerator = isMe && opts.detail ? this.roleService.isModerator(user) : null;
const isAdmin = isMe && opts.detail ? this.roleService.isAdministrator(user) : null;
const policies = opts.detail ? await this.roleService.getUserPolicies(user.id) : null;
const isModerator = (isMe || iAmModerator) && opts.detail ? this.roleService.isModerator(user) : null;
const isAdmin = (isMe || iAmModerator) && opts.detail ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && opts.detail ? await this.announcementService.getUnreadAnnouncements(user) : null;
const notificationsInfo = isMe && opts.detail ? await this.getNotificationsInfo(user.id) : null;
@ -426,16 +426,20 @@ export class UserEntityService implements OnModuleInit {
userId: user.id,
}).then(result => result >= 1)
: false,
roles: this.roleService.getUserRoles(user.id).then(roles => roles.filter(role => role.isPublic).sort((a, b) => b.displayOrder - a.displayOrder).map(role => ({
id: role.id,
name: role.name,
color: role.color,
iconUrl: role.iconUrl,
description: role.description,
isModerator: role.isModerator,
isAdministrator: role.isAdministrator,
displayOrder: role.displayOrder,
}))),
roles: this.roleService.getUserRoles(user.id).then(roles => roles
.filter(role => role.isPublic || iAmModerator)
.sort((a, b) => b.displayOrder - a.displayOrder)
.map(role => ({
id: role.id,
name: role.name,
color: role.color,
iconUrl: role.iconUrl,
description: role.description,
isModerator: role.isModerator,
isAdministrator: role.isAdministrator,
displayOrder: role.displayOrder,
}))
),
memo: meId == null ? null : await this.userMemosRepository.findOneBy({
userId: meId,
targetUserId: user.id,
@ -443,7 +447,7 @@ export class UserEntityService implements OnModuleInit {
moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined,
} : {}),
...(opts.detail && isMe ? {
...(opts.detail && (isMe || iAmModerator) ? {
avatarId: user.avatarId,
bannerId: user.bannerId,
isModerator: isModerator,
@ -468,7 +472,7 @@ export class UserEntityService implements OnModuleInit {
where: { userId: user.id, isMentioned: true },
take: 1,
}).then(count => count > 0),
hasUnreadAnnouncement: unreadAnnouncements!.length > 0,
hasUnreadAnnouncement: (unreadAnnouncements?.length ?? 0) > 0,
unreadAnnouncements,
hasUnreadAntenna: this.getHasUnreadAntenna(user.id),
hasUnreadChannel: false, // 後方互換性のため

View File

@ -7,9 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSpacer :contentMax="narrow ? 800 : 1100">
<div ref="rootEl" class="ftskorzw" :class="{ wide: !narrow }" style="container-type: inline-size;">
<div class="main _gaps">
<!-- TODO -->
<!-- <div class="punished" v-if="user.isSuspended"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i> {{ i18n.ts.userSuspended }}</div> -->
<!-- <div class="punished" v-if="user.isSilenced"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i> {{ i18n.ts.userSilenced }}</div> -->
<div v-if="user.isSuspended" class="punished"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i> {{ i18n.ts.userSuspended }}</div>
<div v-if="user.isLimited" class="punished"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i> {{ i18n.ts.userLimited }}</div>
<div v-if="user.isSilenced" class="punished"><i class="ti ti-alert-triangle" style="margin-right: 8px;"></i> {{ i18n.ts.userSilenced }}</div>
<div class="profile _gaps">
<MkAccountMoved v-if="user.movedTo" :movedTo="user.movedTo"/>
@ -312,6 +312,10 @@ onUnmounted(() => {
> .punished {
font-size: 0.8em;
padding: 16px;
background: var(--infoWarnBg);
color: var(--infoWarnFg);
border-radius: var(--radius);
overflow: clip;
}
> .profile {

View File

@ -13,6 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<span :class="$style.userMInfoMetaSub"><span class="acct _monospace">@{{ acct(user) }}</span></span>
<span :class="$style.userMInfoMetaState">
<span v-if="suspended" :class="$style.suspended">Suspended</span>
<span v-if="limited" :class="$style.limited">Limited</span>
<span v-if="silenced" :class="$style.silenced">Silenced</span>
<span v-if="moderator" :class="$style.moderator">Moderator</span>
</span>
@ -53,6 +54,7 @@ const props = defineProps<{
const moderator = computed(() => props.user.isModerator ?? false);
const silenced = computed(() => props.user.isSilenced ?? false);
const limited = computed(() => props.user.isLimited ?? false);
const suspended = computed(() => props.user.isSuspended ?? false);
</script>
@ -103,6 +105,7 @@ const suspended = computed(() => props.user.isSuspended ?? false);
}
> .suspended,
> .limited,
> .silenced,
> .moderator {
display: inline-block;
@ -117,6 +120,11 @@ const suspended = computed(() => props.user.isSuspended ?? false);
border-color: var(--error);
}
> .limited {
color: var(--error);
border-color: var(--error);
}
> .silenced {
color: var(--warn);
border-color: var(--warn);