Make the personal tag streams actually work
This commit is contained in:
parent
2fbd141361
commit
07f5797f2f
@ -370,7 +370,7 @@ class ShowstreamAction extends ProfileAction
|
|||||||
{
|
{
|
||||||
$notice = empty($this->tag)
|
$notice = empty($this->tag)
|
||||||
? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
|
? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
|
||||||
: $this->user->getTaggedNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null, $this->tag);
|
: $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
|
||||||
|
|
||||||
$pnl = new ProfileNoticeList($notice, $this);
|
$pnl = new ProfileNoticeList($notice, $this);
|
||||||
$cnt = $pnl->show();
|
$cnt = $pnl->show();
|
||||||
|
@ -375,6 +375,12 @@ class Notice extends Memcached_DataObject
|
|||||||
if ($tag->find()) {
|
if ($tag->find()) {
|
||||||
while ($tag->fetch()) {
|
while ($tag->fetch()) {
|
||||||
$tag->blowCache($blowLast);
|
$tag->blowCache($blowLast);
|
||||||
|
$ck = 'profile:notice_ids_tagged:' . $this->profile_id . ':' . $tag->tag;
|
||||||
|
|
||||||
|
$cache->delete($ck);
|
||||||
|
if ($blowLast) {
|
||||||
|
$cache->delete($ck . ';last');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$tag->free();
|
$tag->free();
|
||||||
|
@ -153,18 +153,16 @@ class Profile extends Memcached_DataObject
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTaggedNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null, $tag=null)
|
function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null)
|
||||||
{
|
{
|
||||||
// XXX: I'm not sure this is going to be any faster. It probably isn't.
|
|
||||||
$ids = Notice::stream(array($this, '_streamTaggedDirect'),
|
$ids = Notice::stream(array($this, '_streamTaggedDirect'),
|
||||||
array(),
|
array($tag),
|
||||||
'profile:notice_ids:' . $this->id,
|
'profile:notice_ids_tagged:' . $this->id . ':' . $tag,
|
||||||
$offset, $limit, $since_id, $before_id, $since, $tag);
|
$offset, $limit, $since_id, $max_id, $since);
|
||||||
common_debug(print_r($ids, true));
|
|
||||||
return Notice::getStreamByIds($ids);
|
return Notice::getStreamByIds($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null)
|
||||||
{
|
{
|
||||||
// XXX: I'm not sure this is going to be any faster. It probably isn't.
|
// XXX: I'm not sure this is going to be any faster. It probably isn't.
|
||||||
$ids = Notice::stream(array($this, '_streamDirect'),
|
$ids = Notice::stream(array($this, '_streamDirect'),
|
||||||
@ -175,18 +173,23 @@ class Profile extends Memcached_DataObject
|
|||||||
return Notice::getStreamByIds($ids);
|
return Notice::getStreamByIds($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _streamTaggedDirect($offset, $limit, $since_id, $before_id, $since=null, $tag=null)
|
function _streamTaggedDirect($tag, $offset, $limit, $since_id, $max_id, $since)
|
||||||
{
|
{
|
||||||
common_debug('_streamTaggedDirect()');
|
// XXX It would be nice to do this without a join
|
||||||
|
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
$notice->profile_id = $this->id;
|
|
||||||
$query = "select id from notice join notice_tag on id=notice_id where tag='" . $notice->escape($tag) . "' and profile_id=" . $notice->escape($notice->profile_id);
|
$query =
|
||||||
|
"select id from notice join notice_tag on id=notice_id where tag='".
|
||||||
|
$notice->escape($tag) .
|
||||||
|
"' and profile_id=" . $notice->escape($this->id);
|
||||||
|
|
||||||
if ($since_id != 0) {
|
if ($since_id != 0) {
|
||||||
$query .= " and id > $since_id";
|
$query .= " and id > $since_id";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id != 0) {
|
if ($max_id != 0) {
|
||||||
$query .= " and id < $before_id";
|
$query .= " and id < $max_id";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($since)) {
|
if (!is_null($since)) {
|
||||||
@ -198,21 +201,19 @@ class Profile extends Memcached_DataObject
|
|||||||
if (!is_null($offset)) {
|
if (!is_null($offset)) {
|
||||||
$query .= " limit $offset, $limit";
|
$query .= " limit $offset, $limit";
|
||||||
}
|
}
|
||||||
|
|
||||||
$notice->query($query);
|
$notice->query($query);
|
||||||
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
common_debug(print_r($notice, true));
|
|
||||||
$ids[] = $notice->id;
|
$ids[] = $notice->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _streamDirect($offset, $limit, $since_id, $max_id, $since = null)
|
||||||
|
|
||||||
|
|
||||||
function _streamDirect($offset, $limit, $since_id, $before_id, $since = null)
|
|
||||||
{
|
{
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user