Profile->noticeCount minor change

This commit is contained in:
Mikael Nordfeldth 2016-03-08 19:56:25 +01:00
parent 4c7436e328
commit e4310a57cd
1 changed files with 7 additions and 5 deletions

View File

@ -833,19 +833,21 @@ class Profile extends Managed_DataObject
$c = Cache::instance(); $c = Cache::instance();
if (!empty($c)) { if (!empty($c)) {
$cnt = $c->get(Cache::key('profile:notice_count:'.$this->id)); $cnt = $c->get(Cache::key('profile:notice_count:'.$this->getID()));
if (is_integer($cnt)) { if (is_integer($cnt)) {
return (int) $cnt; return (int) $cnt;
} }
} }
$notices = new Notice(); $notices = new Notice();
$notices->profile_id = $this->id; $notices->profile_id = $this->getID();
$notices->verb = ActivityVerb::POST; $notices->whereAddIn('verb',
$cnt = (int) $notices->count('distinct id'); [ActivityUtils::resolveUri(ActivityVerb::POST, true), ActivityVerb::POST],
$notices->columnType('verb'));
$cnt = (int) $notices->count(); // we don't have to provide anything as Notice is key'd
if (!empty($c)) { if (!empty($c)) {
$c->set(Cache::key('profile:notice_count:'.$this->id), $cnt); $c->set(Cache::key('profile:notice_count:'.$this->getID()), $cnt);
} }
return $cnt; return $cnt;