Attempt at fixing forum issues.

This commit is contained in:
flash 2023-09-10 19:13:36 +00:00
parent 3e49f6e503
commit e376671136
3 changed files with 6 additions and 4 deletions

View file

@ -139,7 +139,6 @@ if($categoryInfo->mayHaveTopics()) {
$topic->info = $topicInfo;
$topic->unread = $forumTopics->checkTopicUnread($topicInfo, $currentUser);
$topic->participated = $forumTopics->checkTopicParticipated($topicInfo, $currentUser);
$topic->lastPost = new stdClass;
if($topicInfo->hasUserId()) {
$topic->user = $usersCtx->getUserInfo($topicInfo->getUserId());
@ -147,6 +146,7 @@ if($categoryInfo->mayHaveTopics()) {
}
try {
$topic->lastPost = new stdClass;
$topic->lastPost->info = $lastPostInfo = $forumPosts->getPost(
topicInfo: $topicInfo,
getLast: true,
@ -157,7 +157,9 @@ if($categoryInfo->mayHaveTopics()) {
$topic->lastPost->user = $usersCtx->getUserInfo($lastPostInfo->getUserId());
$topic->lastPost->colour = $usersCtx->getUserColour($topic->lastPost->user);
}
} catch(RuntimeException $ex) {}
} catch(RuntimeException $ex) {
$topic->lastPost = null;
}
}
}

View file

@ -214,7 +214,7 @@ if(!empty($_POST)) {
);
$topicId = $topicInfo->getId();
$forumTopics->incrementCategoryTopics($categoryInfo);
$forumCategories->incrementCategoryTopics($categoryInfo);
} else
$forumTopics->bumpTopic($topicInfo);

View file

@ -351,7 +351,7 @@
{% set topic_author_colour = '--user-colour: ' ~ topic.colour %}
{% endif %}
{% set has_reply = topic.lastPost is defined %}
{% set has_reply = topic.lastPost is defined and topic.lastPost is not null %}
{% if has_reply %}
{% set reply_id = topic.lastPost.info.id %}
{% set reply_created = topic.lastPost.info.createdTime %}