A free, self-hostable news aggregator…
Fix attributeBoolean (#6543)
Alexandre Alapetite7d110c23a936
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.phpindex d96842612..231be0cba 100644--- a/app/Controllers/feedController.php+++ b/app/Controllers/feedController.php@@ -540,7 +540,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {$nbMarkedUnread = 0;if (count($newGuids) > 0) {- if ($feed->attributeBoolean('read_when_same_title_in_feed') === null) {+ if (!$feed->hasAttribute('read_when_same_title_in_feed')) {$readWhenSameTitleInFeed = (int)FreshRSS_Context::userConf()->mark_when['same_title_in_feed'];} elseif ($feed->attributeBoolean('read_when_same_title_in_feed') === false) {$readWhenSameTitleInFeed = 0;diff --git a/app/Models/AttributesTrait.php b/app/Models/AttributesTrait.phpindex e94a973d9..8795d81d9 100644--- a/app/Models/AttributesTrait.php+++ b/app/Models/AttributesTrait.php@@ -15,6 +15,11 @@ trait FreshRSS_AttributesTrait {return $this->attributes;}+ /** @param non-empty-string $key */+ public function hasAttribute(string $key): bool {+ return isset($this->attributes[$key]);+ }+/*** @param non-empty-string $key* @return array<int|string,mixed>|nulldiff --git a/app/Models/Entry.php b/app/Models/Entry.phpindex ad480f3e6..3caa1ddb9 100644--- a/app/Models/Entry.php+++ b/app/Models/Entry.php@@ -672,8 +672,7 @@ HTML;return;}if (!$this->isRead()) {- if ($feed->attributeBoolean('read_upon_reception') ||- ($feed->attributeBoolean('read_upon_reception') === null && FreshRSS_Context::userConf()->mark_when['reception'])) {+ if ($feed->attributeBoolean('read_upon_reception') ?? FreshRSS_Context::userConf()->mark_when['reception']) {$this->_isRead(true);Minz_ExtensionManager::callHook('entry_auto_read', $this, 'upon_reception');}diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtmlindex 43ed78b44..0d9252910 100644--- a/app/views/helpers/feed/update.phtml+++ b/app/views/helpers/feed/update.phtml@@ -200,7 +200,7 @@<label class="group-name" for="read_when_same_title_in_feed"><?= _t('conf.reading.read.when') ?></label><div class="group-controls"><select name="read_when_same_title_in_feed" id="read_when_same_title_in_feed" class="w50">- <option value=""<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>+ <option value=""<?= $this->feed->hasAttribute('read_when_same_title_in_feed') ? '' : ' selected="selected"' ?>><?= _t('gen.short.by_default') ?></option><option value="0"<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option><option value="10"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option><option value="25"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option>