Correct args for join event

This commit is contained in:
Evan Prodromou 2011-09-18 14:06:35 -04:00
parent 75bdc37b61
commit 2f1953ca25

View File

@ -752,11 +752,11 @@ class OStatusPlugin extends Plugin
* deny the join. * deny the join.
* *
* @param User_group $group * @param User_group $group
* @param User $user * @param Profile $profile
* *
* @return mixed hook return value * @return mixed hook return value
*/ */
function onStartJoinGroup($group, $user) function onStartJoinGroup($group, $profile)
{ {
$oprofile = Ostatus_profile::staticGet('group_id', $group->id); $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
if ($oprofile) { if ($oprofile) {
@ -768,15 +768,13 @@ class OStatusPlugin extends Plugin
// NOTE: we don't use Group_member::asActivity() since that record // NOTE: we don't use Group_member::asActivity() since that record
// has not yet been created. // has not yet been created.
$member = Profile::staticGet($user->id);
$act = new Activity(); $act = new Activity();
$act->id = TagURI::mint('join:%d:%d:%s', $act->id = TagURI::mint('join:%d:%d:%s',
$member->id, $profile->id,
$group->id, $group->id,
common_date_iso8601(time())); common_date_iso8601(time()));
$act->actor = ActivityObject::fromProfile($member); $act->actor = ActivityObject::fromProfile($profile);
$act->verb = ActivityVerb::JOIN; $act->verb = ActivityVerb::JOIN;
$act->object = $oprofile->asActivityObject(); $act->object = $oprofile->asActivityObject();
@ -786,10 +784,10 @@ class OStatusPlugin extends Plugin
// TRANS: Success message for subscribe to group attempt through OStatus. // TRANS: Success message for subscribe to group attempt through OStatus.
// TRANS: %1$s is the member name, %2$s is the subscribed group's name. // TRANS: %1$s is the member name, %2$s is the subscribed group's name.
$act->content = sprintf(_m('%1$s has joined group %2$s.'), $act->content = sprintf(_m('%1$s has joined group %2$s.'),
$member->getBestName(), $profile->getBestName(),
$oprofile->getBestName()); $oprofile->getBestName());
if ($oprofile->notifyActivity($act, $member)) { if ($oprofile->notifyActivity($act, $profile)) {
return true; return true;
} else { } else {
$oprofile->garbageCollect(); $oprofile->garbageCollect();
@ -809,7 +807,7 @@ class OStatusPlugin extends Plugin
* it'll be left with a stray membership record. * it'll be left with a stray membership record.
* *
* @param User_group $group * @param User_group $group
* @param Profile $user * @param Profile $profile
* *
* @return mixed hook return value * @return mixed hook return value
*/ */