From eb955fe6294fc4f256001bb8324ff73c2b9cd362 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 14 Jul 2014 17:11:54 +0200 Subject: [PATCH] "Notice posted" message in Ajax title for NewnoticeAction --- actions/newnotice.php | 4 ++++ lib/action.php | 2 +- plugins/Favorite/actions/favor.php | 8 +++++--- plugins/Favorite/classes/Fave.php | 13 ++----------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index a01b41453e..81438502fa 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -58,6 +58,10 @@ class NewnoticeAction extends FormAction */ function title() { + if ($this->getInfo() && $this->stored instanceof Notice) { + // TRANS: Page title after sending a notice. + return _('Notice posted'); + } // TRANS: Page title for sending a new notice. return _m('TITLE','New notice'); } diff --git a/lib/action.php b/lib/action.php index d76baf8c8f..4909af9926 100644 --- a/lib/action.php +++ b/lib/action.php @@ -235,7 +235,7 @@ class Action extends HTMLOutputter // lawsuit $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); // TRANS: Title for conversation page. - $this->element('title', null, _m('TITLE','Notice')); + $this->element('title', null, $this->title()); $this->elementEnd('head'); $this->elementStart('body'); if ($this->getError()) { diff --git a/plugins/Favorite/actions/favor.php b/plugins/Favorite/actions/favor.php index 98f88183e3..5b73ae20bf 100644 --- a/plugins/Favorite/actions/favor.php +++ b/plugins/Favorite/actions/favor.php @@ -86,9 +86,11 @@ class FavorAction extends FormAction $act->title = ActivityUtils::verbToTitle($act->verb); $act->time = strtotime($now); // 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. - $act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'), - $this->scoped->getBestName(), $this->target->getUrl()); + // TRANS: %1$s is a user name or full name, %2$s is a notice URI, %3$s the link to the user's profile. + $act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'), + htmlspecialchars($this->scoped->getBestName()), + htmlspecialchars($this->target->getUrl()), + htmlspecialchars($this->scoped->getUrl())); $stored = Notice::saveActivity($act, $this->scoped, diff --git a/plugins/Favorite/classes/Fave.php b/plugins/Favorite/classes/Fave.php index 8e72df6c8c..f4e8c353f1 100644 --- a/plugins/Favorite/classes/Fave.php +++ b/plugins/Favorite/classes/Fave.php @@ -142,11 +142,7 @@ class Fave extends Managed_DataObject $act->time = strtotime($this->created); // TRANS: Activity title when marking a notice as favorite. $act->title = _("Favor"); - // 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. - $act->content = $target->rendered ?: sprintf(_('%1$s marked notice %2$s as a favorite.'), - $actor->getBestName(), $target->getUrl()); + $act->content = $target->rendered ?: $target->content; $act->actor = $actor->asActivityObject(); $act->target = $target->asActivityObject(); @@ -290,12 +286,7 @@ class Fave extends Managed_DataObject $actobj->objects = array(clone($actobj->target)); $actobj->verb = ActivityVerb::FAVORITE; $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()); + $actobj->content = $target->rendered ?: $target->content; return $actobj; } -- 2.39.5