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

fix: Hide unwatched topics from the recent posts pages #6908

Merged
merged 1 commit into from Aug 21, 2021

Conversation

live627
Copy link
Contributor

@live627 live627 commented Aug 3, 2021

Move the unwatched predicates from LEFT JOINed tables to the WHERE clause to ensure that the value is picked up as intended. Use COALESCE for when the row/value does not exist.

Fix #6907

Signed-off-by: John Rayes live627@gmail.com

Move the unwatched predicates from LEFT JOINed tables to the WHERE clause to ensure that the value is picked up as intended. Use COALESCE for when the row/value does not exist.

Fix SimpleMachines#6907

Signed-off-by: John Rayes <live627@gmail.com>
@live627 live627 added the Topics label Aug 3, 2021
@live627 live627 added this to the 2.1.0 milestone Aug 3, 2021
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = {int:current_member})
WHERE t.' . $query_this_board . ($context['showing_all_topics'] && !empty($earliest_msg) ? '
AND t.id_last_msg > {int:earliest_msg}' : (!$context['showing_all_topics'] && empty($_SESSION['first_login']) ? '
AND t.id_last_msg > {int:id_msg_last_visit}' : '')) . '
AND COALESCE(lt.id_msg, lmr.id_msg, 0) < t.id_last_msg' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '',
AND t.approved = {int:is_approved}' : '') . '
AND COALESCE(lt.unwatched, 0) != 1',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is COALESCE realy needed here?
it harm the performance of the query here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for the reason outlined in the op/commit message.

@Sesquipedalian Sesquipedalian merged commit c9ca350 into SimpleMachines:release-2.1 Aug 21, 2021
@pr-triage pr-triage bot added the PR: merged label Aug 21, 2021
@live627 live627 deleted the unwatched branch August 22, 2021 01:17
@sbulen sbulen mentioned this pull request Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unwatched topics still show in the unread topics pages
3 participants