mirror of
https://github.com/humhub/humhub.git
synced 2025-04-22 16:11:55 +02:00
When browsing HumHub from the mobile app, add a warning to the dashbo… (#7166)
* When browsing HumHub from the mobile app, add a warning to the dashboard (IncompleteSetupWarning widget) if HumHub doesn't support push notifications * Add PR ID to changelog * Fix: remove test condition * https://github.com/humhub/app/issues/188#issuecomment-2286315281 * https://github.com/humhub/app/issues/188#issuecomment-2291410729 --------- Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
parent
87e8b5fa6f
commit
0621d87d40
@ -20,6 +20,10 @@ HumHub Changelog
|
||||
- Fix #7151: Disable new post's required validation for `message` when post has attached files
|
||||
- Enh #7106: Enable option for non-member users of a space to create posts
|
||||
- Enh #7160: Default state set to Deny for `Create Private Spaces` and `Create Public Spaces` Groups permissions
|
||||
- Enh #7166: When browsing HumHub from the mobile app, add a warning to the dashboard (`IncompleteSetupWarning` widget) if HumHub doesn't support push notifications
|
||||
|
||||
1.16.2 (Unreleased)
|
||||
---------------------
|
||||
- Fix #7174: In lists, when an item text is displayed on multiple lines, the lines below are not lining up with the first one
|
||||
- Fix #7173: Fix marketplace module label "Professional Edition"
|
||||
- Fix #7176: Fix of broken tests related to `Create Private Spaces` and `Create Public Spaces` Groups permissions
|
||||
|
@ -900,11 +900,7 @@ class SelfTest
|
||||
|
||||
// Check Mobile App - Push Service
|
||||
$title = $titlePrefix . Yii::t('AdminModule.information', 'Mobile App - Push Service');
|
||||
/* @var \humhub\modules\fcmPush\Module|null $pushModule */
|
||||
$pushModule = $modules['fcm-push'] ?? null;
|
||||
if ($pushModule instanceof \humhub\modules\fcmPush\Module &&
|
||||
$pushModule->getIsEnabled() &&
|
||||
$pushModule->getGoService()->isConfigured()) {
|
||||
if (static::isPushModuleAvailable()) {
|
||||
$checks[] = [
|
||||
'title' => $title,
|
||||
'state' => 'OK',
|
||||
@ -948,11 +944,21 @@ class SelfTest
|
||||
return $checks;
|
||||
}
|
||||
|
||||
public static function isPushModuleAvailable(): bool
|
||||
{
|
||||
/* @var \humhub\modules\fcmPush\Module|null $pushModule */
|
||||
$pushModule = $modules['fcm-push'] ?? null;
|
||||
return
|
||||
$pushModule instanceof \humhub\modules\fcmPush\Module &&
|
||||
$pushModule->getIsEnabled() &&
|
||||
$pushModule->getGoService()->isConfigured();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with legacy HumHub configuration options.
|
||||
*
|
||||
* @since 1.16
|
||||
* @return array
|
||||
* @since 1.16
|
||||
*/
|
||||
public static function getLegacyConfigSettings(): array
|
||||
{
|
||||
|
@ -8,7 +8,10 @@
|
||||
namespace humhub\modules\admin\widgets;
|
||||
|
||||
use humhub\components\Widget;
|
||||
use humhub\helpers\DeviceDetectorHelper;
|
||||
use humhub\libs\SelfTest;
|
||||
use humhub\modules\admin\Module;
|
||||
use humhub\widgets\Button;
|
||||
use Yii;
|
||||
use yii\db\Query;
|
||||
use yii\queue\db\Queue;
|
||||
@ -23,6 +26,7 @@ class IncompleteSetupWarning extends Widget
|
||||
{
|
||||
public const PROBLEM_QUEUE_RUNNER = 'queue-runner';
|
||||
public const PROBLEM_CRON_JOBS = 'cron-jobs';
|
||||
public const PROBLEM_MOBILE_APP_PUSH_SERVICE = 'mobile-app-push-service';
|
||||
|
||||
|
||||
/**
|
||||
@ -71,6 +75,10 @@ class IncompleteSetupWarning extends Widget
|
||||
$problems[] = static::PROBLEM_CRON_JOBS;
|
||||
}
|
||||
|
||||
if (DeviceDetectorHelper::isAppRequest() && !SelfTest::isPushModuleAvailable()) {
|
||||
$problems[] = static::PROBLEM_MOBILE_APP_PUSH_SERVICE;
|
||||
}
|
||||
|
||||
return $problems;
|
||||
}
|
||||
|
||||
@ -116,4 +124,16 @@ class IncompleteSetupWarning extends Widget
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function docBtn(string $url): string
|
||||
{
|
||||
if (!Yii::$app->user->isAdmin()) {
|
||||
return '';
|
||||
}
|
||||
return Button::asLink(Yii::t('AdminModule.base', 'Open documentation'))
|
||||
->icon('external-link')
|
||||
->link($url)
|
||||
->loader(false)
|
||||
->options(['target' => '_blank'])
|
||||
->sm();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
* @license https://www.humhub.org/en/licences
|
||||
*/
|
||||
|
||||
use humhub\libs\Html;
|
||||
use humhub\modules\admin\widgets\IncompleteSetupWarning;
|
||||
use humhub\modules\ui\view\components\View;
|
||||
|
||||
@ -21,18 +20,22 @@ use humhub\modules\ui\view\components\View;
|
||||
<ul>
|
||||
<?php if (in_array(IncompleteSetupWarning::PROBLEM_QUEUE_RUNNER, $problems)): ?>
|
||||
<li>
|
||||
<?= Yii::t('AdminModule.base', 'The cron job for the background jobs (queue) does not seem to work properly.'); ?>
|
||||
<?= Yii::t('AdminModule.base', 'The cron job for the background jobs (queue) does not seem to work properly.') ?>
|
||||
<?= IncompleteSetupWarning::docBtn('https://docs.humhub.org/docs/admin/cron-jobs') ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array(IncompleteSetupWarning::PROBLEM_CRON_JOBS, $problems)): ?>
|
||||
<li>
|
||||
<?= Yii::t('AdminModule.base', 'The cron job for the regular tasks (cron) does not seem to work properly.'); ?>
|
||||
<?= Yii::t('AdminModule.base', 'The cron job for the regular tasks (cron) does not seem to work properly.') ?>
|
||||
<?= IncompleteSetupWarning::docBtn('https://docs.humhub.org/docs/admin/cron-jobs') ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array(IncompleteSetupWarning::PROBLEM_MOBILE_APP_PUSH_SERVICE, $problems)): ?>
|
||||
<li>
|
||||
<?= Yii::t('AdminModule.base', 'The mobile app push service is not available. Please install and configure the "Push Notifications" module.') ?>
|
||||
<?= IncompleteSetupWarning::docBtn('https://marketplace.humhub.com/module/fcm-push/installation') ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<br/>
|
||||
<?php if (Yii::$app->user->isAdmin()): ?>
|
||||
<?= Html::a(Yii::t('AdminModule.base', 'Open documentation'), 'https://docs.humhub.org/docs/admin/cron-jobs', ['class' => 'btn btn-danger', 'target' => '_blank']); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user