mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
[ticket/8610] Fix bookmarks when merging all the posts of a topic
PHPBB3-8610
This commit is contained in:
parent
49bc10de4d
commit
d20d86bf10
1 changed files with 18 additions and 4 deletions
|
@ -588,14 +588,22 @@ function merge_posts($topic_id, $to_topic_id)
|
|||
return;
|
||||
}
|
||||
|
||||
$topic_data = get_topic_data(array($to_topic_id), 'm_merge');
|
||||
$sync_topics = array($topic_id, $to_topic_id);
|
||||
|
||||
if (!sizeof($topic_data))
|
||||
$topic_data = get_topic_data($sync_topics, 'm_merge');
|
||||
|
||||
if (!sizeof($topic_data) || empty($topic_data[$to_topic_id]))
|
||||
{
|
||||
$template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
|
||||
return;
|
||||
}
|
||||
|
||||
$sync_forums = array();
|
||||
foreach ($topic_data as $data)
|
||||
{
|
||||
$sync_forums[$data['forum_id']] = $data['forum_id'];
|
||||
}
|
||||
|
||||
$topic_data = $topic_data[$to_topic_id];
|
||||
|
||||
$post_id_list = request_var('post_id_list', array(0));
|
||||
|
@ -630,7 +638,7 @@ function merge_posts($topic_id, $to_topic_id)
|
|||
{
|
||||
$to_forum_id = $topic_data['forum_id'];
|
||||
|
||||
move_posts($post_id_list, $to_topic_id);
|
||||
move_posts($post_id_list, $to_topic_id, false);
|
||||
add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
|
||||
|
||||
// Message and return links
|
||||
|
@ -638,7 +646,7 @@ function merge_posts($topic_id, $to_topic_id)
|
|||
|
||||
// Does the original topic still exist? If yes, link back to it
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE topic_id = ' . $topic_id;
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
@ -662,6 +670,12 @@ function merge_posts($topic_id, $to_topic_id)
|
|||
phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', array($topic_id), $to_topic_id);
|
||||
}
|
||||
|
||||
// Re-sync the topics and forums because the auto-sync was deactivated in the call of move_posts()
|
||||
sync('topic_reported', 'topic_id', $sync_topics);
|
||||
sync('topic_attachment', 'topic_id', $sync_topics);
|
||||
sync('topic', 'topic_id', $sync_topics, true);
|
||||
sync('forum', 'forum_id', $sync_forums, true, true);
|
||||
|
||||
// Link to the new topic
|
||||
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>');
|
||||
$redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id");
|
||||
|
|
Loading…
Add table
Reference in a new issue