mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-66707 mod_forum: do not blindly mark discussion replies as read
This commit is contained in:
parent
ee23a8cf25
commit
4bd0eaf732
1 changed files with 8 additions and 4 deletions
|
@ -328,9 +328,6 @@ $rendererfactory = mod_forum\local\container::get_renderer_factory();
|
|||
$discussionrenderer = $rendererfactory->get_discussion_renderer($forum, $discussion, $displaymode);
|
||||
$orderpostsby = $displaymode == FORUM_MODE_FLATNEWEST ? 'created DESC' : 'created ASC';
|
||||
$replies = $postvault->get_replies_to_post($USER, $post, $capabilitymanager->can_view_any_private_reply($USER), $orderpostsby);
|
||||
$postids = array_map(function($post) {
|
||||
return $post->get_id();
|
||||
}, array_merge([$post], array_values($replies)));
|
||||
|
||||
if ($move == -1 and confirm_sesskey()) {
|
||||
$forumname = format_string($forum->get_name(), true);
|
||||
|
@ -341,5 +338,12 @@ echo $discussionrenderer->render($USER, $post, $replies);
|
|||
echo $OUTPUT->footer();
|
||||
|
||||
if ($istracked && !$CFG->forum_usermarksread) {
|
||||
forum_tp_mark_posts_read($USER, $postids);
|
||||
if ($displaymode == FORUM_MODE_THREADED) {
|
||||
forum_tp_add_read_record($USER->id, $post->get_id());
|
||||
} else {
|
||||
$postids = array_map(function($post) {
|
||||
return $post->get_id();
|
||||
}, array_merge([$post], array_values($replies)));
|
||||
forum_tp_mark_posts_read($USER, $postids);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue