mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-23 18:38:18 +00:00
TopicSubscriptionsPager: Fix exception when no subscriptions
Bug: T362507 Change-Id: I569fb2ae017edc9d8e49910faff85e8c9301077d
This commit is contained in:
parent
c7595b012b
commit
cf792094bb
|
@ -36,7 +36,7 @@ class TopicSubscriptionsPager extends TablePager {
|
||||||
private ThreadItemFormatter $threadItemFormatter;
|
private ThreadItemFormatter $threadItemFormatter;
|
||||||
|
|
||||||
/** @var array<string,DatabaseThreadItem[]> */
|
/** @var array<string,DatabaseThreadItem[]> */
|
||||||
private array $threadItemsByName;
|
private array $threadItemsByName = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
IContextSource $context,
|
IContextSource $context,
|
||||||
|
@ -55,6 +55,9 @@ class TopicSubscriptionsPager extends TablePager {
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function preprocessResults( $result ) {
|
public function preprocessResults( $result ) {
|
||||||
|
if ( !$result->numRows() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$lb = $this->linkBatchFactory->newLinkBatch();
|
$lb = $this->linkBatchFactory->newLinkBatch();
|
||||||
$itemNames = [];
|
$itemNames = [];
|
||||||
foreach ( $result as $row ) {
|
foreach ( $result as $row ) {
|
||||||
|
@ -63,7 +66,6 @@ class TopicSubscriptionsPager extends TablePager {
|
||||||
}
|
}
|
||||||
$lb->execute();
|
$lb->execute();
|
||||||
|
|
||||||
$this->threadItemsByName = [];
|
|
||||||
// Increased limit to allow finding and skipping over some bad permalinks
|
// Increased limit to allow finding and skipping over some bad permalinks
|
||||||
$threadItems = $this->threadItemStore->findNewestRevisionsByName( $itemNames, $this->mLimit * 5 );
|
$threadItems = $this->threadItemStore->findNewestRevisionsByName( $itemNames, $this->mLimit * 5 );
|
||||||
foreach ( $threadItems as $threadItem ) {
|
foreach ( $threadItems as $threadItem ) {
|
||||||
|
|
Loading…
Reference in a new issue