Bug #388

Inline Thread Deletion and Reported Posts

Added by Michael Schlechtinger over 2 years ago. Updated over 2 years ago.

Status:Closed Start date:08/20/2009
Priority:Normal Due date:
Assignee:Tom Moore % Done:

100%

Category:Moderation
Target version:1.4.10
Reproducibility:Always Database Type:
Reported In MyBB Version:1.4.8 Database Version:
PHP Version: SQA assignments:
Browser:

Description

If you delete multiple posts using "Inline Post Moderation" then any reported posts are not marked as reportstatus 0.

If you delete a single post using "Inline Post Moderation" then the report is properly marked as reportstatus 0.

To replicate:

1. Find a thread with more than 2 posts.
2. Report post #2.
3. Using "Inline Post Moderation" delete posts #2 and #3.
4. View reported posts and see the deleted post still there with no info

To View Normal behavior:
1. Find a thread with more than 2 posts.
2. Report post #2.
3. Using "Inline Post Moderation" delete post #2
4. View reported posts and see it's marked

Problem:
moderation.php


    case "do_multideleteposts":

        // Verify incoming POST request
        verify_post_check($mybb->input['my_post_key']);

        $postlist = explode("|", $mybb->input['posts']);
        if(!is_moderator_by_pids($postlist, "candeleteposts"))
        {
            error_no_permission();
        }
        $postlist = array_map('intval', $postlist);
        $pids = implode(',', $postlist);

        $tids = array();
        if($pids)
        {
            $query = $db->simple_select("threads", "tid", "firstpost IN({$pids})");
            while($tid = $db->fetch_field($query, "tid"))
            {
                $tids[] = $tid;
            }
        }

        $deletecount = 0;
        foreach($postlist as $pid)
        {
            $pid = intval($pid);
            $moderation->delete_post($pid);
            $plist[] = $pid;
            $deletecount++;
        }

        // If we have multiple threads, we must be coming from the search
        if(!empty($tids))
        {
            foreach($tids as $tid)
            {
                $moderation->delete_thread($tid);
                mark_reports($tid, "thread");
                $url = get_forum_link($fid);
            }
        }
        // Otherwise we're just deleting from showthread.php
        else
        {
            $query = $db->simple_select("posts", "*", "tid='$tid'");
            $numposts = $db->num_rows($query);
            if(!$numposts)
            {
                $moderation->delete_thread($tid);
                mark_reports($tid, "thread");
                $url = get_forum_link($fid);
            }
            else
            {
                mark_reports($plist, "posts");
                $url = get_thread_link($thread['tid']);
            }
        }

        $lang->deleted_selective_posts = $lang->sprintf($lang->deleted_selective_posts, $deletecount);
        log_moderator_action($modlogdata, $lang->deleted_selective_posts);
        moderation_redirect($url, $lang->redirect_postsdeleted);
        break;


Seems a logic problem. Whatever the solution you choose there is a small bug here.

Associated revisions

Revision 4478
Added by Tom Moore over 2 years ago

Fixes Inline Thread Deletion and Reported Posts (fixes:388)

History

Updated by Tom Moore over 2 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r4478.

Updated by Tom Moore over 2 years ago

  • Assignee set to Tom Moore
  • Target version set to 1.4.10

r4478 applies a fix that will remove the report of the deleted post. I believe this is "proper behaviour" simply because you can't view the report of the post once it's been deleted (rendering it useless, in effect).

It stops fiddling around with the moderation code to limit bugs too and saves up some space in the database.

If this is wrong, discuss. :)

Updated by Michael Schlechtinger over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF