- Fixed. The missing controls now appear at:

Plans & Platform > Plans, Prices & Entitlements > Groups Available for 
each tier.
Config > Feature Availability > Groups Enabled as the global master 
switch.
This commit is contained in:
Ty Clifford
2026-06-08 16:47:02 -04:00
parent 2881a3b338
commit de8ec43aa4
9 changed files with 107 additions and 42 deletions
+9 -3
View File
@@ -73,6 +73,10 @@ function groupsEnabled(): bool {
return (bool)getConfigVal('groups.enabled', true);
}
function groupsAvailableForUser(array $user): bool {
return groupsEnabled() && (bool)featureValue($user, 'groups_available', true);
}
function setConfigValues(array $changes): void {
$config = getConfig();
foreach ($changes as $path => $value) {
@@ -353,7 +357,7 @@ function seedPlans(PDO $db): void {
'price' => 0, 'sort' => 0,
'features' => [
'voice_messages' => true, 'recording_status' => false, 'auto_voice_send' => false,
'auto_voice_play' => false,
'auto_voice_play' => false, 'groups_available' => true,
'group_member_limit' => 2, 'username_color' => false, 'text_archive_days' => 30,
'text_export' => true, 'voice_archive' => false, 'voice_export' => false, 'email_2fa' => false,
],
@@ -363,7 +367,7 @@ function seedPlans(PDO $db): void {
'price' => 499, 'sort' => 10,
'features' => [
'voice_messages' => true, 'recording_status' => true, 'auto_voice_send' => true,
'auto_voice_play' => true,
'auto_voice_play' => true, 'groups_available' => true,
'group_member_limit' => 4, 'username_color' => true, 'text_archive_days' => 90,
'text_export' => true, 'voice_archive' => true, 'voice_export' => true, 'email_2fa' => true,
],
@@ -373,7 +377,7 @@ function seedPlans(PDO $db): void {
'price' => 999, 'sort' => 20,
'features' => [
'voice_messages' => true, 'recording_status' => true, 'auto_voice_send' => true,
'auto_voice_play' => true,
'auto_voice_play' => true, 'groups_available' => true,
'group_member_limit' => 8, 'username_color' => true, 'text_archive_days' => 365,
'text_export' => true, 'voice_archive' => true, 'voice_export' => true, 'email_2fa' => true,
],
@@ -393,6 +397,8 @@ function seedPlans(PDO $db): void {
$insertFeature->execute([$planId, $key, json_encode($value)]);
}
}
$db->exec("INSERT OR IGNORE INTO plan_features (plan_id,feature_key,value_json)
SELECT id,'groups_available','true' FROM plans");
$freeId = (int)$db->query("SELECT id FROM plans WHERE slug = 'free'")->fetchColumn();
$db->prepare("UPDATE users SET plan_id = ? WHERE plan_id IS NULL")->execute([$freeId]);
}