X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fconversationnoticestream.php;h=b9b03c45c5b6354b262a8a6ba02967c95dcea7a8;hb=cd3cff451f2ac12ebe1b98c6ab643a0e4e931599;hp=adf610ffe7b2841c0d15260cc093b3d0216a573b;hpb=e274ec4900172b5a53f38e5d9f44d899bf490dc3;p=quix0rs-gnu-social.git diff --git a/lib/conversationnoticestream.php b/lib/conversationnoticestream.php index adf610ffe7..b9b03c45c5 100644 --- a/lib/conversationnoticestream.php +++ b/lib/conversationnoticestream.php @@ -20,7 +20,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * - * @category Cache + * @category NoticeStream * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. @@ -52,8 +52,7 @@ class ConversationNoticeStream extends ScopingNoticeStream $profile = Profile::current(); } - parent::__construct(new CachingNoticeStream(new RawConversationNoticeStream($id), - 'notice:conversation_ids:'.$id), + parent::__construct(new RawConversationNoticeStream($id), $profile); } } @@ -77,24 +76,29 @@ class RawConversationNoticeStream extends NoticeStream $this->id = $id; } - function getNoticeIds($offset, $limit, $since_id, $max_id) + function getNoticeIds($offset, $limit, $since_id=null, $max_id=null) { $notice = new Notice(); - - $notice->selectAdd(); // clears it + // SELECT + $notice->selectAdd(); $notice->selectAdd('id'); + // WHERE $notice->conversation = $this->id; - - $notice->orderBy('created DESC, id DESC'); - + if (!empty($since_id)) { + $notice->whereAdd(sprintf('notice.id > %d', $since_id)); + } + if (!empty($max_id)) { + $notice->whereAdd(sprintf('notice.id <= %d', $max_id)); + } if (!is_null($offset)) { $notice->limit($offset, $limit); } - Notice::addWhereSinceId($notice, $since_id); - Notice::addWhereMaxId($notice, $max_id); - + // ORDER BY + // currently imitates the previously used "_reverseChron" sorting + $notice->orderBy('notice.created DESC'); + $notice->find(); return $notice->fetchAll('id'); } -} \ No newline at end of file +}