Fix OStatus groups by making Ostatus_profile::localProfile() work for groups

We need to look up a feed profile for HandleFeedEntryWithProfile events,
regardless of whether they're an OStatus user, group, or something else;
this is the least hairy way of doing that--the alternative being
to keep spreading the same logic all over the calling code.

Theoretically, this change might allow OStatusGroups to be recorded
as the authors of activities if they pass through any authorless
activities; but that's why we have checkAuthorship().
This commit is contained in:
Joshua Judson Rosen 2014-11-23 17:42:12 -05:00 committed by Mikael Nordfeldth
parent d2e1a8c706
commit 4b875e0fd0

View File

@ -88,6 +88,10 @@ class Ostatus_profile extends Managed_DataObject
*/
public function localProfile()
{
if ($this->isGroup()) {
return $this->localGroup()->getProfile();
}
$profile = Profile::getKV('id', $this->profile_id);
if ($profile instanceof Profile) {
return $profile;