X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fnoticelist.php;h=5df123fb5f9102303886931f7d0cdfa5e8567cbb;hb=3fb3ddb3a6472db243254c432ab930216de3b705;hp=a4781d9daa7a077cb33917eaad1c931501e94149;hpb=513c54fa89085fde783a73c298d61576f834b131;p=quix0rs-gnu-social.git diff --git a/lib/noticelist.php b/lib/noticelist.php index a4781d9daa..5df123fb5f 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -124,21 +124,48 @@ class NoticeList extends Widget static function prefill(&$notices, $avatarSize=AVATAR_STREAM_SIZE) { - // Prefill the profiles - $profiles = Notice::fillProfiles($notices); - // Prefill the avatars - Profile::fillAvatars($profiles, $avatarSize); + if (Event::handle('StartNoticeListPrefill', array(&$notices, $avatarSize))) { + + // Prefill attachments + Notice::fillAttachments($notices); + // Prefill attachments + Notice::fillFaves($notices); + // Prefill repeat data + Notice::fillRepeats($notices); + // Prefill the profiles + $profiles = Notice::fillProfiles($notices); + // Prefill the avatars + Profile::fillAvatars($profiles, $avatarSize); - $p = Profile::current(); + $p = Profile::current(); - $ids = array(); + if (!empty($p)) { + + $ids = array(); - foreach ($notices as $notice) { - $ids[] = $notice->id; - } + foreach ($notices as $notice) { + $ids[] = $notice->id; + } - if (!empty($p)) { - Memcached_DataObject::pivotGet('Fave', 'notice_id', $ids, array('user_id' => $p->id)); - } + Memcached_DataObject::pivotGet('Fave', 'notice_id', $ids, array('user_id' => $p->id)); + Memcached_DataObject::pivotGet('Notice', 'repeat_of', $ids, array('profile_id' => $p->id)); + } + + if (common_config('notice', 'hidespam')) { + + $pids = array(); + + foreach ($profiles as $profile) { + $pids[] = $profile->id; + } + + Memcached_DataObject::pivotGet('Profile_role', + 'profile_id', + $pids, + array('role' => Profile_role::SILENCED)); + } + + Event::handle('EndNoticeListPrefill', array(&$notices, &$profiles, $avatarSize)); + } } }