1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 23:25:30 +02:00

[ticket/17187] Repair mcp link to first unread post

PHPBB3-17187
This commit is contained in:
Christian Schnegelberger 2023-09-23 15:54:21 +02:00
parent bdbbc63b9c
commit b0248d2d78
3 changed files with 19 additions and 0 deletions

View File

@ -344,6 +344,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
}
$topic_row = array_merge($topic_row, array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row_ary['topic_id']}&mode=topic_view"),
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&f=$forum_id&t={$row_ary['topic_id']}&mode=topic_view&view=unread#unread"),
'S_SELECT_TOPIC' => ($merge_select && !in_array($row_ary['topic_id'], $source_topic_ids)) ? true : false,
'U_SELECT_TOPIC' => $u_select_topic,

View File

@ -54,6 +54,7 @@ function mcp_topic_view($id, $mode, $action)
$sort = isset($_POST['sort']) ? true : false;
$submitted_id_list = $request->variable('post_ids', array(0));
$checked_ids = $post_id_list = $request->variable('post_id_list', array(0));
$view = $request->variable('view', '');
// Resync Topic?
if ($action == 'resync')
@ -179,6 +180,7 @@ function mcp_topic_view($id, $mode, $action)
{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];
$rowset_posttime['post_time'] = $row['post_time'];
}
$db->sql_freeresult($result);
@ -194,6 +196,16 @@ function mcp_topic_view($id, $mode, $action)
$topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
}
$first_unread = $post_unread = false;
$post_unread = (isset($topic_tracking_info[$topic_id]) && $rowset_posttime['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
$s_first_unread = false;
if (!$first_unread && $post_unread)
{
$s_first_unread = $first_unread = true;
}
$has_unapproved_posts = $has_deleted_posts = false;
// Grab extensions
@ -287,10 +299,13 @@ function mcp_topic_view($id, $mode, $action)
'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])),
'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
'S_FIRST_UNREAD' => $s_first_unread,
'S_UNREAD_VIEW' => $view == 'unread',
'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details",
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&p=' . $row['post_id']) : '',
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
);
/**

View File

@ -95,6 +95,9 @@
<div id="topicreview" class="topicreview">
<!-- BEGIN postrow -->
<!-- EVENT mcp_topic_postrow_post_before -->
<!-- IF postrow.S_FIRST_UNREAD -->
<a id="unread" class="anchor"<!-- IF S_UNREAD_VIEW --> data-url="{postrow.U_MINI_POST}"<!-- ENDIF -->></a>
<!-- ENDIF -->
<div class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<div class="inner">