asddad
All checks were successful
Deploy / deploy (push) Successful in 49s

This commit is contained in:
2026-07-19 22:08:55 +02:00
parent b9673814b5
commit b9026c7808
6 changed files with 319 additions and 13 deletions

View File

@@ -157,6 +157,7 @@ final class AccountPages
$communityConfig = file_exists($communityCfg) ? require $communityCfg : [];
$community = $pdo ? new Community($pdo, $communityConfig) : null;
$communityAccess = $pdo ? new CommunityAccess($pdo, $communityConfig) : null;
$communityMigration = $pdo ? new CommunityMigration($pdo) : null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = $_POST['action'] ?? '';
@@ -296,6 +297,12 @@ final class AccountPages
}
$communityAccess->submitApplication($userId, (string)($_POST['motivation'] ?? ''));
$info = 'Deine Bewerbung wurde eingereicht.';
} elseif ($action === 'community_migrate') {
if (!$communityAccess || !$communityMigration || !$communityAccess->canManageApplications($userId)) {
throw new \RuntimeException('Keine Berechtigung für die Community-Migration.');
}
$communityMigration->apply();
$info = 'Die Community-Migration wurde ausgeführt.';
}
} catch (\Throwable $e) {
$error = $e->getMessage();
@@ -377,6 +384,8 @@ final class AccountPages
'reply_blocked' => false,
'reason' => null,
];
$communityIsSiteAdmin = $communityAccess ? $communityAccess->canManageApplications($userId) : false;
$communityMigrationStatus = ($communityMigration && $communityIsSiteAdmin) ? $communityMigration->status() : null;
return compact(
'flash',
@@ -392,7 +401,9 @@ final class AccountPages
'communityRoles',
'communityApplication',
'communityCanApply',
'communityRestrictions'
'communityRestrictions',
'communityIsSiteAdmin',
'communityMigrationStatus'
);
}