summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-11-29 10:33:16 +0000
committerDries Buytaert <dries@buytaert.net>2009-11-29 10:33:16 +0000
commitdde80e874b756975dc9e568ead500fec70af56d0 (patch)
tree02c981f6c6e2f0f254e4b498777d6e0fe6c2545d /modules
parent500b2a0022c68eb11263699c57d706beb8ec84e3 (diff)
downloadbrdo-dde80e874b756975dc9e568ead500fec70af56d0.tar.gz
brdo-dde80e874b756975dc9e568ead500fec70af56d0.tar.bz2
- Patch #642178 by mfb: fixed two comment updates bug.
Diffstat (limited to 'modules')
-rw-r--r--modules/tracker/tracker.module8
-rw-r--r--modules/tracker/tracker.test7
2 files changed, 11 insertions, 4 deletions
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index ebf2370a3..8b011ed66 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -191,11 +191,10 @@ function tracker_node_delete($node, $arg = 0) {
* comments so we need to check for those here.
*/
function tracker_comment_update($comment) {
- $comment = (array) $comment;
// comment_save() calls hook_comment_publish() for all published comments
// so we to handle all other values here.
- if ($comment['status'] != COMMENT_PUBLISHED) {
- _tracker_remove($comment['nid'], $comment['uid'], $comment['timestamp']);
+ if ($comment->status != COMMENT_PUBLISHED) {
+ _tracker_remove($comment->nid, $comment->uid, $comment->changed);
}
}
@@ -309,9 +308,10 @@ function _tracker_remove($nid, $uid = NULL, $changed = NULL) {
// Comments are a second reason to keep the user's subscription.
if (!$keep_subscription) {
// Check if the user has commented at least once on the given nid
- $keep_subscription = db_query_range('SELECT COUNT(*) FROM {comment} WHERE nid = :nid AND uid = :uid AND status = 0', 0, 1, array(
+ $keep_subscription = db_query_range('SELECT COUNT(*) FROM {comment} WHERE nid = :nid AND uid = :uid AND status = :status', 0, 1, array(
':nid' => $nid,
':uid' => $uid,
+ ':status' => COMMENT_PUBLISHED,
))->fetchField();
}
diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test
index da818909f..8e5effe09 100644
--- a/modules/tracker/tracker.test
+++ b/modules/tracker/tracker.test
@@ -83,6 +83,13 @@ class TrackerTest extends DrupalWebTestCase {
$this->assertText($my_published->title[FIELD_LANGUAGE_NONE][0]['value'], t("Published nodes show up in the user's tracker listing."));
$this->assertNoText($other_published_no_comment->title[FIELD_LANGUAGE_NONE][0]['value'], t("Other user's nodes do not show up in the user's tracker listing."));
$this->assertText($other_published_my_comment->title[FIELD_LANGUAGE_NONE][0]['value'], t("Nodes that the user has commented on appear in the user's tracker listing."));
+
+ // Verify that unpublished comments are removed from the tracker.
+ $admin_user = $this->drupalCreateUser(array('administer comments', 'access user profiles'));
+ $this->drupalLogin($admin_user);
+ $this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save'));
+ $this->drupalGet('user/' . $this->user->uid . '/track');
+ $this->assertNoText($other_published_my_comment->title[FIELD_LANGUAGE_NONE][0]['value'], 'Unpublished comments are not counted on the tracker listing.');
}
/**