fix: prevent super admin demotion

This commit is contained in:
lezi-fun committed 2026-08-12 20:12:22 +08:00
1 parent 3840bb3c54
commit 96e0e6f08e
8 files changed
+47 -18

No files matched your search

+3 -1
View File
@@ -80,7 +80,9 @@ export default function AdminUsers() {
{u.created_at ? new Date(u.created_at).toLocaleDateString(dateLocale) : '—'}
</td>
<td style={{ padding: '10px 12px', textAlign: 'center' }}>
{isCurrent ? (
{u.is_super ? (
<span style={{ fontSize: 12, color: '#94a3b8' }}>{t('admin.user.cannotSuper')}</span>
) : isCurrent ? (
<span style={{ fontSize: 12, color: '#94a3b8' }}>{t('admin.user.cannotSelf')}</span>
) : isAdmin ? (
<button className="btn-sm btn-secondary" style={{ padding: '4px 12px' }} onClick={() => handleRole(u, 'user')}>{t('admin.user.makeUser')}</button>