diff --git a/privatemsg.module b/privatemsg.module index ac72c850640666be35ade735594f72553819bd12..c63b4b1aa026521170534c5a67fb0c2bb3aa5c9b 100755 --- a/privatemsg.module +++ b/privatemsg.module @@ -545,7 +545,9 @@ function privatemsg_thread_load($thread_id, $account = NULL, $start = NULL, $use $conditions['account'] = $account; } - // #2033161 privatemsg_message_load_multiple will load all threads if empty + // If the $ids parameter is empty, privatemsg_message_load_multiple will + // load all threads. + // @see https://drupal.org/node/2033161 $ids = $query->execute()->fetchCol(); if (count($ids)) { $thread['messages'] = privatemsg_message_load_multiple($ids, $conditions); diff --git a/privatemsg.test b/privatemsg.test index 33cd2436941123fc3474bd7e9ca240f48e6a6464..5f987a90d3a134ffbaddb837560e80a0424d693b 100644 --- a/privatemsg.test +++ b/privatemsg.test @@ -85,6 +85,11 @@ class PrivatemsgTestCase extends PrivatemsgBaseTestCase { $subject = $this->randomName(20); $body = $this->randomName(50); + // Make sure that $no_recipient is involved in another thread to assert that + // no unrelated messages are displayed. + // @see https://drupal.org/node/2033161 + $unrelated = privatemsg_new_thread(array($no_recipient), $subject, $body, array('author' => $author)); + $response = privatemsg_new_thread(array($recipient), $subject, $body, array('author' => $author)); $this->drupalLogin($user_no_read_msg);