Skip to content

Commit

Permalink
Forum: Fix duplicated entries in topic_read table (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 authored Nov 22, 2023
1 parent 68249cb commit dc0854f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions application/modules/forum/controllers/Newpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Modules\Forum\Mappers\Post as PostMapper;
use Modules\Forum\Mappers\Topic as TopicMapper;
use Modules\Forum\Mappers\Forum as ForumMapper;
use Modules\Forum\Mappers\TrackRead as TrackReadMapper;
use Modules\Forum\Mappers\TopicSubscription as TopicSubscriptionMapper;
use Modules\Admin\Mappers\Emails as EmailsMapper;
use Modules\Forum\Models\ForumPost as ForumPostModel;
Expand Down Expand Up @@ -127,10 +126,7 @@ public function indexAction()
->setDateCreated($dateTime);
$postMapper->save($postModel);

// Mark topic as read.
$trackReadMapper = new TrackReadMapper();
$trackReadMapper->markTopicAsRead($this->getUser()->getId(), $topicId, $forum->getId());

// Topic is marked as read when showing it (controller: showposts, action: index).
$postsPerPage = (empty($this->getConfig()->get('forum_postsPerPage'))) ? $this->getConfig()->get('defaultPaginationObjects') : $this->getConfig()->get('forum_postsPerPage');
$countPosts = $forumMapper->getCountPostsByTopicId($topicId);
$page = ($this->getConfig()->get('forum_DESCPostorder') ? 1 : ceil($countPosts / $postsPerPage));
Expand Down

0 comments on commit dc0854f

Please sign in to comment.