We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit ce92bc71 authored by Brion Vibber's avatar Brion Vibber

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.
parent 66518df4
......@@ -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)) {
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment