| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | use FluentCommunity\App\Services\FeedsHelper; |
| 11 | 11 | use FluentCommunity\App\Services\Helper; |
| 12 | 12 | use FluentCommunity\Framework\Support\Arr; |
| 13 | 13 | use FluentCommunity\Modules\Course\Model\Course; |
| 14 | +use FluentCommunity\Modules\PushNotification\PushNotificationModule; | |
| 14 | 15 | |
| 15 | 16 | class Utility |
| 16 | 17 | { |
| 17 | 18 | public static function isDev() |
| @@ -116,8 +117,9 @@ | ||
| 116 | 117 | 'has_crm_sync' => 'no', |
| 117 | 118 | 'content_moderation' => 'no', |
| 118 | 119 | 'followers_module' => 'no', |
| 119 | 120 | 'custom_profile_fields' => 'no', |
| 121 | + 'pwa_module' => 'no', | |
| 120 | 122 | ]; |
| 121 | 123 | |
| 122 | 124 | if (defined('FLUENT_COMMUNITY_CLOUD_STORAGE') && FLUENT_COMMUNITY_CLOUD_STORAGE) { |
| 123 | 125 | $features['cloud_storage'] = 'yes'; |
| @@ -134,8 +136,9 @@ | ||
| 134 | 136 | $features['cloud_storage'] = 'no'; |
| 135 | 137 | $features['user_badge'] = 'no'; |
| 136 | 138 | $features['followers_module'] = 'no'; |
| 137 | 139 | $features['custom_profile_fields'] = 'no'; |
| 140 | + $features['pwa_module'] = 'no'; | |
| 138 | 141 | } |
| 139 | 142 | |
| 140 | 143 | return $features; |
| 141 | 144 | } |
| @@ -268,8 +271,9 @@ | ||
| 268 | 271 | 'can_deactive_account' => 'no', |
| 269 | 272 | 'email_auto_login' => 'yes', |
| 270 | 273 | 'enable_gravatar' => 'yes', |
| 271 | 274 | 'enable_user_sync' => 'yes', |
| 275 | + 'skip_crm_undeliverable_emails' => 'yes', | |
| 272 | 276 | 'members_page_status' => 'everybody', // everybody, logged_in, admin_only |
| 273 | 277 | 'profile_page_visibility' => 'everybody', // everybody, logged_in, admin_only |
| 274 | 278 | 'user_space_visibility' => 'everybody', // everybody, logged_in, admin_only |
| 275 | 279 | 'leaderboard_members_visibility' => 'everybody', // everybody, logged_in, admin_only |
| @@ -473,8 +477,29 @@ | ||
| 473 | 477 | |
| 474 | 478 | return $settings; |
| 475 | 479 | } |
| 476 | 480 | |
| 481 | + public static function getPushNotificationSettings() | |
| 482 | + { | |
| 483 | + static $settings; | |
| 484 | + if ($settings) return $settings; | |
| 485 | + | |
| 486 | + $default = [ | |
| 487 | + 'push_enabled' => 'yes', | |
| 488 | + 'com_my_post_push' => 'yes', | |
| 489 | + 'reply_my_com_push' => 'yes', | |
| 490 | + 'mention_push' => 'yes', | |
| 491 | + 'co_com_push' => 'yes', | |
| 492 | + 'prompt_placements' => PushNotificationModule::PROMPT_PLACEMENTS | |
| 493 | + ]; | |
| 494 | + | |
| 495 | + $settings = self::getOption('global_push_settings', $default); | |
| 496 | + | |
| 497 | + $settings = wp_parse_args($settings, $default); | |
| 498 | + | |
| 499 | + return $settings; | |
| 500 | + } | |
| 501 | + | |
| 477 | 502 | public static function hasEmailAnnouncementEnabled() |
| 478 | 503 | { |
| 479 | 504 | $settings = self::getEmailNotificationSettings(); |
| 480 | 505 | return Arr::get($settings, 'mention_mail', 'no') === 'yes'; |
| @@ -525,8 +550,25 @@ | ||
| 525 | 550 | $key = 'fluent_community_post_topics'; |
| 526 | 551 | $topics = self::getFromCache($key, function () { |
| 527 | 552 | $topics = Term::where('taxonomy_name', 'post_topic')->orderBy('title', 'ASC')->get(); |
| 528 | 553 | |
| 554 | + // Respect the admin-defined order (settings.serial) when present; | |
| 555 | + // topics without a serial fall back to the alphabetical order above. | |
| 556 | + $topics = $topics->sort(function ($a, $b) { | |
| 557 | + $serialA = Arr::get($a->settings, 'serial'); | |
| 558 | + $serialB = Arr::get($b->settings, 'serial'); | |
| 559 | + if ($serialA === null && $serialB === null) { | |
| 560 | + return 0; | |
| 561 | + } | |
| 562 | + if ($serialA === null) { | |
| 563 | + return 1; | |
| 564 | + } | |
| 565 | + if ($serialB === null) { | |
| 566 | + return -1; | |
| 567 | + } | |
| 568 | + return (int) $serialA <=> (int) $serialB; | |
| 569 | + })->values(); | |
| 570 | + | |
| 529 | 571 | /* |
| 530 | 572 | * object_id = term_id |
| 531 | 573 | * meta_key = space_id |
| 532 | 574 | */ |
| @@ -549,8 +591,9 @@ | ||
| 549 | 591 | 'title' => $topic->title, |
| 550 | 592 | 'description' => $topic->description, |
| 551 | 593 | 'slug' => $topic->slug, |
| 552 | 594 | 'admin_only' => Arr::get($topic->settings, 'admin_only', 'no'), |
| 595 | + 'serial' => Arr::get($topic->settings, 'serial'), | |
| 553 | 596 | 'space_ids' => isset($relations[$topic->id]) ? $relations[$topic->id] : [] |
| 554 | 597 | ]; |
| 555 | 598 | } |
| 556 | 599 | |