From e23271fff180c8bfd7211aff0cbbf98613f219f6 Mon Sep 17 00:00:00 2001
From: yurabakhtin <yurybakh@gmail.com>
Date: Fri, 5 Feb 2021 15:22:53 +0300
Subject: [PATCH 1/2] Show current update channel with link to module
 configuration

---
 Module.php                      | 19 ++++++++++++++++++-
 docs/CHANGELOG.md               |  4 ++++
 module.json                     |  2 +-
 views/update/index_noupdate.php |  8 ++++++--
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Module.php b/Module.php
index 059df19..04bd94e 100644
--- a/Module.php
+++ b/Module.php
@@ -3,6 +3,7 @@
 namespace humhub\modules\updater;
 
 use humhub\models\Setting;
+use humhub\modules\updater\models\ConfigureForm;
 use Yii;
 use yii\base\Exception;
 use yii\helpers\Url;
@@ -73,9 +74,25 @@ public function getCurlOptions()
         return \humhub\libs\CURLHelper::getOptions();
     }
 
-
+    /**
+     * Get current update channel value
+     *
+     * @return string
+     */
     public function getUpdateChannel()
     {
         return $this->settings->get('channel', 'stable');
     }
+
+    /**
+     * Get current update channel title
+     *
+     * @return string
+     */
+    public function getUpdateChannelTitle()
+    {
+        $updateChannel = $this->getUpdateChannel();
+        $updateChannelTitles = ConfigureForm::getChannels();
+        return isset($updateChannelTitles[$updateChannel]) ? $updateChannelTitles[$updateChannel] : $updateChannel;
+    }
 }
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index d71201a..a074804 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,6 +1,10 @@
 Changelog
 =========
 
+2.1.10  (Unreleased)
+--------------------------
+- Enh #24: Show current update channel with link to module configuration
+
 2.1.9  (February 5, 2021)
 --------------------------
 - Fix: Better handle errors when assets directory cannot be cleared (+ retry)
diff --git a/module.json b/module.json
index fd894b1..3dd0562 100644
--- a/module.json
+++ b/module.json
@@ -9,5 +9,5 @@
     "humhub": {
         "minVersion": "1.0"
     },
-    "version": "2.1.9"
+    "version": "2.1.10"
 }
\ No newline at end of file
diff --git a/views/update/index_noupdate.php b/views/update/index_noupdate.php
index ab067d4..33fa176 100644
--- a/views/update/index_noupdate.php
+++ b/views/update/index_noupdate.php
@@ -3,8 +3,12 @@
     <div class="panel-body">
         
         <?php echo Yii::t('UpdaterModule.base', 'There is no new HumHub update available!'); ?>
-        <br />
-        
+        <br /><br />
+
+        <?= Yii::t('UpdaterModule.base', 'Current update channel: {updateChannel}', [
+            'updateChannel' => '<strong>' . Yii::$app->getModule('updater')->getUpdateChannelTitle() . '</strong>'
+        ]); ?>
+        <?= \humhub\libs\Html::a(Yii::t('UpdaterModule.base', 'Change'), \yii\helpers\Url::to(['/updater/admin']), ['class' => 'btn btn-primary btn-sm'] ); ?>
     </div>
 
 </div>
\ No newline at end of file

From d2ce4af12018a02c9571940609ed0b15cca5579e Mon Sep 17 00:00:00 2001
From: yurabakhtin <yurybakh@gmail.com>
Date: Fri, 5 Feb 2021 15:50:47 +0300
Subject: [PATCH 2/2] Fix url to update module

---
 views/update/index.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/update/index.php b/views/update/index.php
index dbf979c..5bee3c9 100644
--- a/views/update/index.php
+++ b/views/update/index.php
@@ -14,7 +14,7 @@
         <?php if ($newUpdaterAvailable): ?>
             <br />
             <div class="alert alert-danger">
-                <?= Html::a('Update', ['/admin/module/list-updates'], ['class' => 'btn btn-danger pull-right']); ?>
+                <?= Html::a('Update', ['/marketplace/update'], ['class' => 'btn btn-danger pull-right']); ?>
                 <strong><?php echo Yii::t('UpdaterModule.base', 'New updater version available!'); ?></strong><br />
                 <?php echo Yii::t('UpdaterModule.base', 'There is a new version of the updater module available. Please update before proceed.'); ?>
             </div>