Some code aligning for consistency
This commit is contained in:
parent
cae43344ec
commit
174586bd51
@ -65,7 +65,9 @@ class Group_member extends Managed_DataObject
|
|||||||
$member->group_id = $group_id;
|
$member->group_id = $group_id;
|
||||||
$member->profile_id = $profile_id;
|
$member->profile_id = $profile_id;
|
||||||
$member->created = common_sql_now();
|
$member->created = common_sql_now();
|
||||||
$member->uri = self::newURI($profile_id, $group_id, $member->created);
|
$member->uri = self::newUri(Profile::getByID($profile_id),
|
||||||
|
User_group::getByID($group_id),
|
||||||
|
$member->created);
|
||||||
|
|
||||||
$result = $member->insert();
|
$result = $member->insert();
|
||||||
|
|
||||||
@ -166,7 +168,7 @@ class Group_member extends Managed_DataObject
|
|||||||
|
|
||||||
$act = new Activity();
|
$act = new Activity();
|
||||||
|
|
||||||
$act->id = $this->getURI();
|
$act->id = $this->getUri();
|
||||||
|
|
||||||
$act->actor = $member->asActivityObject();
|
$act->actor = $member->asActivityObject();
|
||||||
$act->verb = ActivityVerb::JOIN;
|
$act->verb = ActivityVerb::JOIN;
|
||||||
@ -201,20 +203,8 @@ class Group_member extends Managed_DataObject
|
|||||||
mail_notify_group_join($this->getGroup(), $this->getMember());
|
mail_notify_group_join($this->getGroup(), $this->getMember());
|
||||||
}
|
}
|
||||||
|
|
||||||
function getURI()
|
function getUri()
|
||||||
{
|
{
|
||||||
if (!empty($this->uri)) {
|
return $this->uri ?: self::newUri($this->getMember(), $this->getGroup()->getProfile(), $this->created);
|
||||||
return $this->uri;
|
|
||||||
} else {
|
|
||||||
return self::newURI($this->profile_id, $this->group_id, $this->created);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static function newURI($profile_id, $group_id, $created)
|
|
||||||
{
|
|
||||||
return TagURI::mint('join:%d:%d:%s',
|
|
||||||
$profile_id,
|
|
||||||
$group_id,
|
|
||||||
common_date_iso8601($created));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ class Subscription extends Managed_DataObject
|
|||||||
$sub->jabber = 1;
|
$sub->jabber = 1;
|
||||||
$sub->sms = 1;
|
$sub->sms = 1;
|
||||||
$sub->created = common_sql_now();
|
$sub->created = common_sql_now();
|
||||||
$sub->uri = self::newURI($sub->subscriber,
|
$sub->uri = self::newUri($subscriber,
|
||||||
$sub->subscribed,
|
$other,
|
||||||
$sub->created);
|
$sub->created);
|
||||||
|
|
||||||
$result = $sub->insert();
|
$result = $sub->insert();
|
||||||
@ -267,18 +267,20 @@ class Subscription extends Managed_DataObject
|
|||||||
return $sub;
|
return $sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSubscriber()
|
||||||
|
{
|
||||||
|
return Profile::getByID($this->subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubscribed()
|
||||||
|
{
|
||||||
|
return Profile::getByID($this->subscribed);
|
||||||
|
}
|
||||||
|
|
||||||
function asActivity()
|
function asActivity()
|
||||||
{
|
{
|
||||||
$subscriber = Profile::getKV('id', $this->subscriber);
|
$subscriber = $this->getSubscriber();
|
||||||
$subscribed = Profile::getKV('id', $this->subscribed);
|
$subscribed = $this->getSubscribed();
|
||||||
|
|
||||||
if (!$subscriber instanceof Profile) {
|
|
||||||
throw new NoProfileException($this->subscriber);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$subscribed instanceof Profile) {
|
|
||||||
throw new NoProfileException($this->subscribed);
|
|
||||||
}
|
|
||||||
|
|
||||||
$act = new Activity();
|
$act = new Activity();
|
||||||
|
|
||||||
@ -286,7 +288,7 @@ class Subscription extends Managed_DataObject
|
|||||||
|
|
||||||
// XXX: rationalize this with the URL
|
// XXX: rationalize this with the URL
|
||||||
|
|
||||||
$act->id = $this->getURI();
|
$act->id = $this->getUri();
|
||||||
|
|
||||||
$act->time = strtotime($this->created);
|
$act->time = strtotime($this->created);
|
||||||
// TRANS: Activity title when subscribing to another person.
|
// TRANS: Activity title when subscribing to another person.
|
||||||
@ -431,20 +433,8 @@ class Subscription extends Managed_DataObject
|
|||||||
return parent::update($dataObject);
|
return parent::update($dataObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getURI()
|
public function getUri()
|
||||||
{
|
{
|
||||||
if (!empty($this->uri)) {
|
return $this->uri ?: self::newUri($this->getSubscriber(), $this->getSubscribed(), $this->created);
|
||||||
return $this->uri;
|
|
||||||
} else {
|
|
||||||
return self::newURI($this->subscriber, $this->subscribed, $this->created);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static function newURI($subscriber_id, $subscribed_id, $created)
|
|
||||||
{
|
|
||||||
return TagURI::mint('follow:%d:%d:%s',
|
|
||||||
$subscriber_id,
|
|
||||||
$subscribed_id,
|
|
||||||
common_date_iso8601($created));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user