Fix author search link (#3315)

Before, when clicking on the author link, the search was done on the
main stream in the normal view. It's fine until the feed is not visible
in the main stream.
Now, the current context is used along with the search.

See #3314
This commit is contained in:
Alexis Degrugillier
2021-01-02 18:59:57 -05:00
committed by GitHub
parent 9c6682e7ed
commit 31cb07ac1a
3 changed files with 9 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ $today = @strtotime('today');
echo $first ? _t('gen.short.by_author') . ' ' : '· ';
$first = false;
?>
<em><a href="<?= _url('index', 'index', 'search', 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))) ?>"><?= $author ?></a></em>
<em><a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>"><?= $author ?></a></em>
<?php endforeach; ?>
</div><?php endif; ?>
</div>

View File

@@ -57,7 +57,7 @@ $content_width = FreshRSS_Context::$user_conf->content_width;
echo $first ? _t('gen.short.by_author') . ' ' : '· ';
$first = false;
?>
<em><a href="<?= _url('index', 'index', 'search', 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))) ?>"><?= $author ?></a></em>
<em><a href="<?= Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:' . str_replace(' ', '+', htmlspecialchars_decode($author, ENT_QUOTES))])) ?>"><?= $author ?></a></em>
<?php
endforeach;
echo ' — ';

View File

@@ -71,6 +71,13 @@ class Minz_Request {
'params' => self::$params,
);
}
public static function modifiedCurrentRequest(array $extraParams = null) {
$currentRequest = self::currentRequest();
if (null !== $extraParams) {
$currentRequest['params'] = array_merge($currentRequest['params'], $extraParams);
}
return $currentRequest;
}
/**
* Setteurs