aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-01-28 22:16:24 +0100
committerGravatar GitHub <noreply@github.com> 2024-01-28 22:16:24 +0100
commit6228f959f7ff8d459aa5bc253d225c7e7f716165 (patch)
treeb361dc2b13bc40a90437cfa765e3e38f8250aa0c
parentd36e11085d4caabac220d3bef48dbc99614ed61e (diff)
Fix default category name (#6073)
fix https://github.com/FreshRSS/FreshRSS/issues/6071
-rw-r--r--app/Models/Category.php6
-rw-r--r--app/views/helpers/category/update.phtml4
2 files changed, 6 insertions, 4 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 49ef2d283..230431311 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -124,7 +124,7 @@ class FreshRSS_Category extends Minz_Model {
public function _id(int $id): void {
$this->id = $id;
if ($id === FreshRSS_CategoryDAO::DEFAULTCATEGORYID) {
- $this->_name(_t('gen.short.default_category'));
+ $this->name = _t('gen.short.default_category');
}
}
@@ -133,7 +133,9 @@ class FreshRSS_Category extends Minz_Model {
}
public function _name(string $value): void {
- $this->name = mb_strcut(trim($value), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8');
+ if ($this->id !== FreshRSS_CategoryDAO::DEFAULTCATEGORYID) {
+ $this->name = mb_strcut(trim($value), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8');
+ }
}
/** @param array<FreshRSS_Feed>|FreshRSS_Feed $values */
diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml
index 36c0abfe8..b3f92b449 100644
--- a/app/views/helpers/category/update.phtml
+++ b/app/views/helpers/category/update.phtml
@@ -22,9 +22,9 @@
<div class="form-group">
<label class="group-name" for="name"><?= _t('sub.category.title') ?></label>
<div class="group-controls">
- <input type="text" name="name" id="name" value="<?= $this->category->name() ?>" <?php
+ <input type="text" name="name" id="name" value="<?= $this->category->name() ?>" <?=
//Disallow changing the name of the default category
- echo $this->category->id() == FreshRSS_CategoryDAO::DEFAULTCATEGORYID ? 'disabled="disabled"' : '';
+ $this->category->id() === FreshRSS_CategoryDAO::DEFAULTCATEGORYID ? 'readonly="readonly"' : ''
?> />
</div>
</div>