chore: update default ban reason

This commit is contained in:
javayhu 2025-05-11 11:51:54 +08:00
parent 245dfaa6e1
commit 70d35e5fd5
4 changed files with 11 additions and 7 deletions

View File

@ -452,6 +452,8 @@
"ban": {
"reason": "Ban Reason",
"reasonPlaceholder": "Enter the reason for banning this user",
"defaultReason": "Spamming",
"never": "Never",
"expires": "Ban Expires",
"selectDate": "Select Date",
"button": "Ban User",

View File

@ -453,6 +453,8 @@
"ban": {
"reason": "封禁原因",
"reasonPlaceholder": "请输入封禁该用户的原因",
"defaultReason": "垃圾信息",
"never": "永不解禁",
"expires": "封禁到期时间",
"selectDate": "选择日期",
"button": "封禁用户",

View File

@ -47,7 +47,7 @@ export function UserDetailViewer({ user }: UserDetailViewerProps) {
const isMobile = useIsMobile();
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | undefined>();
const [banReason, setBanReason] = useState('');
const [banReason, setBanReason] = useState(t('ban.defaultReason'));
const [banExpiresAt, setBanExpiresAt] = useState<Date | undefined>();
const triggerRefresh = useUsersStore((state) => state.triggerRefresh);
@ -210,11 +210,11 @@ export function UserDetailViewer({ user }: UserDetailViewerProps) {
<div className="text-muted-foreground">
{t('ban.reason')}: {user.banReason}
</div>
{user.banExpires && (
<div className="text-muted-foreground">
{t('ban.expires')}: {formatDate(user.banExpires)}
</div>
)}
<div className="text-muted-foreground">
{t('ban.expires')}:{' '}
{(user.banExpires && formatDate(user.banExpires)) ||
t('ban.never')}
</div>
<Button
variant="destructive"
onClick={handleUnban}

View File

@ -148,7 +148,7 @@ export const auth = betterAuth({
// support user management, ban/unban user, manage user roles, etc.
admin({
// https://www.better-auth.com/docs/plugins/admin#default-ban-reason
defaultBanReason: 'Spamming',
// defaultBanReason: 'Spamming',
defaultBanExpiresIn: undefined,
bannedUserMessage:
'You have been banned from this application. Please contact support if you believe this is an error.',