Drop timestamp cutoff parameter from User::getCurrentNotice() and Profile::getCurrentNotice().

It's not currently used, and won't be efficient when we update the notice.profile_id_idx index to optimize for our id-based sorting when pulling user post lists for profile pages, feeds etc.
This commit is contained in:
Brion Vibber 2010-03-11 11:01:01 -08:00
parent 66518df435
commit ce92bc7143
2 changed files with 14 additions and 7 deletions

View File

@ -147,14 +147,16 @@ class Profile extends Memcached_DataObject
return ($this->fullname) ? $this->fullname : $this->nickname;
}
# Get latest notice on or before date; default now
function getCurrentNotice($dt=null)
/**
* Get the most recent notice posted by this user, if any.
*
* @return mixed Notice or null
*/
function getCurrentNotice()
{
$notice = new Notice();
$notice->profile_id = $this->id;
if ($dt) {
$notice->whereAdd('created < "' . $dt . '"');
}
// @fixme change this to sort on notice.id only when indexes are updated
$notice->orderBy('created DESC, notice.id DESC');
$notice->limit(1);
if ($notice->find(true)) {

View File

@ -132,13 +132,18 @@ class User extends Memcached_DataObject
return !in_array($nickname, $blacklist);
}
function getCurrentNotice($dt=null)
/**
* Get the most recent notice posted by this user, if any.
*
* @return mixed Notice or null
*/
function getCurrentNotice()
{
$profile = $this->getProfile();
if (!$profile) {
return null;
}
return $profile->getCurrentNotice($dt);
return $profile->getCurrentNotice();
}
function getCarrier()