]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/command.php
fix ModPlus 'remote profile options' popup for Realtime
[quix0rs-gnu-social.git] / lib / command.php
index 2a8075e7bacc11aa9d4f52b0b0b04f9f6ed1263e..29aa286d1db0d890950a962f0eb3053db4dceb7b 100644 (file)
@@ -287,6 +287,18 @@ class FavCommand extends Command
     function handle($channel)
     {
         $notice = $this->getNotice($this->other);
+
+        $fave            = new Fave();
+        $fave->user_id   = $this->user->id;
+        $fave->notice_id = $notice->id;
+        $fave->find();
+
+        if ($fave->fetch()) {
+            // TRANS: Error message text shown when a favorite could not be set because it has already been favorited.
+            $channel->error($this->user, _('Could not create favorite: already favorited.'));
+            return;
+        }
+
         $fave = Fave::addNew($this->user->getProfile(), $notice);
 
         if (!$fave) {
@@ -300,7 +312,7 @@ class FavCommand extends Command
 
         $other = User::staticGet('id', $notice->profile_id);
 
-        if ($other && $other->id != $user->id) {
+        if ($other && $other->id != $this->user->id) {
             if ($other->email && $other->emailnotifyfav) {
                 mail_notify_fave($other, $this->user, $notice);
             }
@@ -479,7 +491,7 @@ class MessageCommand extends Command
             return;
         }
 
-        $this->text = common_shorten_links($this->text);
+        $this->text = $this->user->shortenLinks($this->text);
 
         if (Message::contentTooLong($this->text)) {
             // XXX: i18n. Needs plural support.
@@ -582,7 +594,7 @@ class ReplyCommand extends Command
             return;
         }
 
-        $this->text = common_shorten_links($this->text);
+        $this->text = $this->user->shortenLinks($this->text);
 
         if (Notice::contentTooLong($this->text)) {
             // XXX: i18n. Needs plural support.