Skip to content

Commit

Permalink
Fix for ticket #1131. If the rss feed is for an item, then retrieve t…
Browse files Browse the repository at this point in the history
…he item. Using the left and right pointers find all the comments for the child items. Thanks to jankoprowski for the initial investigation.
  • Loading branch information
Tim Almdal committed Jun 16, 2010
1 parent 1fb3339 commit ea8653f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/comment/helpers/comment_rss.php
Expand Up @@ -33,13 +33,20 @@ static function feed($feed_id, $offset, $limit, $id) {
return;
}

Kohana_Log::add("error", "feed($feed_id, $offset, $limit, $id)");
$comments = ORM::factory("comment")
->viewable()
->where("state", "=", "published")
->order_by("created", "DESC");

if ($feed_id == "item") {
$comments->where("item_id", "=", $id);
$item = ORM::factory("item", $id);
$subquery = db::select("id")
->from("items")
->where("left_ptr", ">=", $item->left_ptr)
->where("right_ptr", "<=", $item->right_ptr);
$comments
->where("item_id", "in", $subquery);
}

$feed = new stdClass();
Expand Down

0 comments on commit ea8653f

Please sign in to comment.