Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forum: Fix duplicated entries in topic_read table #869

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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