]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/repeat.php
add a privacy flag to user table
[quix0rs-gnu-social.git] / actions / repeat.php
index 194833fe0cf56a56f9a69039549178ca720d32e0..44c57456fa3cb6f5ead2b24d0016ee778aba9e4a 100644 (file)
@@ -1,7 +1,6 @@
 <?php
-
 /**
- * Forward action.
+ * Repeat action.
  *
  * PHP version 5
  *
@@ -33,7 +32,7 @@ if (!defined('STATUSNET')) {
 }
 
 /**
- * Forward action
+ * Repeat action
  *
  * @category Action
  * @package  StatusNet
@@ -41,8 +40,7 @@ if (!defined('STATUSNET')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  * @link     http://status.net/
  */
-
-class ForwardAction extends Action
+class RepeatAction extends Action
 {
     var $user = null;
     var $notice = null;
@@ -54,40 +52,31 @@ class ForwardAction extends Action
         $this->user = common_current_user();
 
         if (empty($this->user)) {
-            $this->clientError(_("Only logged-in users can forward notices."));
+            // TRANS: Client error displayed when trying to repeat a notice while not logged in.
+            $this->clientError(_('Only logged-in users can repeat notices.'));
             return false;
         }
 
         $id = $this->trimmed('notice');
 
         if (empty($id)) {
-            $this->clientError(_("No notice specified."));
+            // TRANS: Client error displayed when trying to repeat a notice while not providing a notice ID.
+            $this->clientError(_('No notice specified.'));
             return false;
         }
 
         $this->notice = Notice::staticGet('id', $id);
 
         if (empty($this->notice)) {
-            $this->clientError(_("No notice specified."));
-            return false;
-        }
-
-        if ($this->user->id == $this->notice->profile_id) {
-            $this->clientError(_("You can't forward your own notice."));
+            // TRANS: Client error displayed when trying to repeat a non-existing notice.
+            $this->clientError(_('No notice specified.'));
             return false;
         }
 
         $token  = $this->trimmed('token-'.$id);
 
         if (empty($token) || $token != common_session_token()) {
-            $this->clientError(_("There was a problem with your session token. Try again, please."));
-            return false;
-        }
-
-        $profile = $this->user->getProfile();
-
-        if ($profile->hasForwarded($id)) {
-            $this->clientError(_("You already forwarded that notice."));
+            $this->clientError(_('There was a problem with your session token. Try again, please.'));
             return false;
         }
 
@@ -101,22 +90,25 @@ class ForwardAction extends Action
      *
      * @return void
      */
-
     function handle($args)
     {
-        $forward = Forward::saveNew($this->user->id, $this->notice->id);
+        $repeat = $this->notice->repeat($this->user->id, 'web');
 
         if ($this->boolean('ajax')) {
             $this->startHTML('text/xml;charset=utf-8');
             $this->elementStart('head');
-            $this->element('title', null, _('Forwarded'));
+            // TRANS: Title after repeating a notice.
+            $this->element('title', null, _('Repeated'));
             $this->elementEnd('head');
             $this->elementStart('body');
-            $this->element('p', array('id' => 'forward_response'), _('Forwarded!'));
+            $this->element('p', array('id' => 'repeat_response',
+                                      'class' => 'repeated'),
+                                // TRANS: Confirmation text after repeating a notice.
+                                _('Repeated!'));
             $this->elementEnd('body');
             $this->elementEnd('html');
         } else {
-            // FIXME!
+            // @todo FIXME!
         }
     }
 }