Put text content into Favorite activities/activityobjects
This commit is contained in:
parent
5ebe01ba36
commit
ac44695c44
@ -128,8 +128,8 @@ class Fave extends Managed_DataObject
|
|||||||
|
|
||||||
function asActivity()
|
function asActivity()
|
||||||
{
|
{
|
||||||
$notice = $this->getTarget();
|
$target = $this->getTarget();
|
||||||
$profile = $this->getActor();
|
$actor = $this->getActor();
|
||||||
|
|
||||||
$act = new Activity();
|
$act = new Activity();
|
||||||
|
|
||||||
@ -139,23 +139,22 @@ class Fave extends Managed_DataObject
|
|||||||
|
|
||||||
$act->id = $this->getUri();
|
$act->id = $this->getUri();
|
||||||
|
|
||||||
$act->time = strtotime($this->modified);
|
$act->time = strtotime($this->created);
|
||||||
// TRANS: Activity title when marking a notice as favorite.
|
// TRANS: Activity title when marking a notice as favorite.
|
||||||
$act->title = _("Favor");
|
$act->title = _("Favor");
|
||||||
// TRANS: Ntofication given when a user marks a notice as favorite.
|
// If the rendered notice content does not exist, generate our own content.
|
||||||
|
// TRANS: Notification given when a user marks a notice as favorite.
|
||||||
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
|
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
|
||||||
$act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'),
|
$act->content = $target->rendered ?: sprintf(_('%1$s marked notice %2$s as a favorite.'),
|
||||||
$profile->getBestName(),
|
$actor->getBestName(), $target->getUrl());
|
||||||
$notice->getUrl());
|
|
||||||
|
|
||||||
$act->actor = $profile->asActivityObject();
|
$act->actor = $actor->asActivityObject();
|
||||||
// $act->target = $notice->asActivityObject();
|
$act->target = $target->asActivityObject();
|
||||||
// $act->objects = array(clone($act->target));
|
$act->objects = array(clone($act->target));
|
||||||
$act->objects[] = $notice->asActivityObject();
|
|
||||||
|
|
||||||
$url = common_local_url('AtomPubShowFavorite',
|
$url = common_local_url('AtomPubShowFavorite',
|
||||||
array('profile' => $profile->id,
|
array('profile' => $actor->id,
|
||||||
'notice' => $notice->id));
|
'notice' => $target->id));
|
||||||
|
|
||||||
$act->selfLink = $url;
|
$act->selfLink = $url;
|
||||||
$act->editLink = $url;
|
$act->editLink = $url;
|
||||||
@ -287,10 +286,16 @@ class Fave extends Managed_DataObject
|
|||||||
$actobj->id = $this->getUri();
|
$actobj->id = $this->getUri();
|
||||||
$actobj->type = ActivityUtils::resolveUri(self::getObjectType());
|
$actobj->type = ActivityUtils::resolveUri(self::getObjectType());
|
||||||
$actobj->actor = $this->getActorObject();
|
$actobj->actor = $this->getActorObject();
|
||||||
$actobj->target = $this->getTarget()->asActivityObject();
|
$actobj->target = $this->getTargetObject();
|
||||||
$actobj->objects = array(clone($actobj->target));
|
$actobj->objects = array(clone($actobj->target));
|
||||||
$actobj->verb = ActivityVerb::FAVORITE;
|
$actobj->verb = ActivityVerb::FAVORITE;
|
||||||
$actobj->title = ActivityUtils::verbToTitle($actobj->verb);
|
$actobj->title = ActivityUtils::verbToTitle($actobj->verb);
|
||||||
|
// If the rendered notice content does not exist, generate our own content.
|
||||||
|
// TRANS: Notification given when a user marks a notice as favorite.
|
||||||
|
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
|
||||||
|
$actobj->content = $target->rendered ?: sprintf(_('%1$s marked notice %2$s as a favorite.'),
|
||||||
|
$this->getActor()->getBestName(),
|
||||||
|
$this->getTarget()->getUrl());
|
||||||
return $actobj;
|
return $actobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user