-
Bug
-
Resolution: Invalid
-
None
-
3.0.RC7
-
None
-
PHP Environment:
Database:
Using server-side topic marking.
Steps to reproduce:
-let another user write a new post in forum 1
-mark all as read in forum 2
-make a new post in a topic in forum 3
-mark all as read in forum 3
-move the topic from forum 3 to forum 2
The topic appears as unread. I think it's because the information about reading it (in forum 2's mark) isn't moved. The function move_topics in includes/functions_admin.php only changes the forum_id in topic_track_table, forum_track_table is ignored. Probably an unread topic moved to a fully-read forum would also appear as read.
I think the only solution which doesn't change the tracking system is to place this piece of pseudocode in move_topics() before '$table_ary=..', ('topic_track_table' isn't necessary anymore in $track_ary).
foreach($topic_ids as $topic_id)
|
{
|
$prev_forum_id = TOPICS_TABLE[topic_id].forum_id;
|
$last_post_time = TOPICS_TABLE[topic_id].topic_last_post_time
|
foreach(USERS_TABLE.user_id as $user_id)
|
{
|
//get the topic's actual marktime (including its old forum's marktime)
|
$topic_mark = TOPIC_TRACK_TABLE[user_id,topic_id].mark_time;
|
if(!isset($topic_mark))
|
$topic_mark = FORUM_TRACK_TABLE[user_id,prev_forum_id].mark_time;
|
else
|
DELETE TOPIC_TRACK_TABLE[user_id,topic_id];
|
|
INSERT INTO TOPICS_TRACK_TABLE VALUES ($user_id,$topic_id,$forum_id,$topic_mark);
|
}
|
}
|
But if it's not possible to mark a topic as unread by inserting into topic_track_table a topic_marktime<topic_last_post_time<forum_marktime, or if we want to manualy sync the forum_track_table for every user (which I think is done for one user in update_forum_tracking_info() called by sync())
then instead of the last INSERT there should be
//the new forum's mark
|
$forum_mark = FORUM_TRACK_TABLE[user_id,forum_id].mark_time;
|
|
if($topic_mark > $forum_mark){
|
if(count(TOPIC_TRACK TABLE[mark_time>$topic_mark]))
|
//usually it's ok to simply raise the new forum's mark
|
FORUM_TRACK_TABLE[user_id,forum_id].mark_time=$topic_mark;
|
else
|
//do what we would do before - insert the deleted entry, but with another forum_id
|
INSERT INTO TOPICS_TRACK_TABLE VALUES ($user_id,$topic_id,$forum_id,$topic_mark);
|
} else if($topic_mark<$last_post_time)
|
{ //some unread posts are older than $forum_mark
|
//if it is possible to show that by putting a topic_mark < forum_mark
|
INSERT INTO TOPICS_TRACK_TABLE VALUES ($user_id,$topic_id,$forum_id,$topic_mark);
|
//else we would have to lower the forum's mark
|
FORUM_TRACK_TABLE[user_id,forum_id].mark_time=$topic_mark;
|
//and then update all affected topics (those that were read and wouldn't be anymore)
|
foreach(TOPICS_TABLE[forum_id,last_post_time<=$forum_mark && >$topic_mark].topic_id as $tid)
|
INSERT INTO TOPIC_TRACK_TABLE VALUES ($user_id,$tid,$forum_id,$forum_mark);
|
}
|
//else topic is read and forum_mark>last_post_time, so everything is ok
|
I guess with cookies it's another story...