Guides/Fixup

* fix showing wrong guide version to staff
 * fix sticky icon offset
This commit is contained in:
Sarjuuk 2025-10-10 20:03:46 +02:00
parent a96f6c4cdf
commit 63053757c9
3 changed files with 9 additions and 7 deletions

View file

@ -68,12 +68,12 @@ class GuideBaseResponse extends TemplateResponse implements ICache
$this->contribute = CONTRIBUTE_NONE;
}
if ($this->articleUrl)
// owner or staff and manual rev passed
if ($this->subject->userCanView() && $this->_get['rev'])
$this->guideRevision = $this->_get['rev'];
// has publicly viewable version
else if ($this->subject->canBeViewed())
$this->guideRevision = $this->subject->getField('rev');
else if ($this->subject->userCanView())
$this->guideRevision = $this->_get['rev'] ?? $this->subject->getField('latest');
else
$this->subject->getField('rev');
$this->h1 = $this->subject->getField('name');
@ -127,7 +127,7 @@ class GuideBaseResponse extends TemplateResponse implements ICache
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], __forceTabs: true);
// the article text itself is added by PageTemplate::addArticle()
// the article text itself is added by TemplateResponse::addArticle()
parent::generate();
$this->result->registerDisplayHook('infobox', [self::class, 'infoboxHook']);

View file

@ -418,7 +418,7 @@ class TemplateResponse extends BaseResponse
if (isset($this->guideRevision))
$article = DB::Aowow()->selectRow('SELECT `article`, `locale`, `editAccess` FROM ?_articles WHERE `type` = ?d AND `typeId` = ?d AND `rev` = ?d',
Type::GUIDE, $this->typeId, $this->guideRevision);
if (!$article && $this->gPageInfo['articleUrl'])
if (!$article && !empty($this->gPageInfo['articleUrl']))
$article = DB::Aowow()->selectRow('SELECT `article`, `locale`, `editAccess` FROM ?_articles WHERE `url` = ? AND `locale` IN (?a) ORDER BY `locale` DESC, `rev` DESC LIMIT 1',
$this->gPageInfo['articleUrl'], [Lang::getLocale()->value, Locale::EN->value]);
if (!$article && !empty($this->type) && isset($this->typeId))

View file

@ -422,10 +422,12 @@
padding-left: 21px;
}
/* aowow - clips in the list marker
.infobox .guide-sticky {
position: relative;
left: -6px;
}
*/
#guiderating {
display: block;