]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Message.php
Corrected pkeys for listGet()
[quix0rs-gnu-social.git] / classes / Message.php
index fa0c5b31812411dd03b08da8a4867add45bb45ed..484d1f724c09749637b802d3976e6a03f1a01e9b 100644 (file)
@@ -38,7 +38,6 @@ class Message extends Memcached_DataObject
     }
 
     static function saveNew($from, $to, $content, $source) {
-
         $sender = Profile::staticGet('id', $from);
 
         if (!$sender->hasRight(Right::NEWMESSAGE)) {
@@ -46,12 +45,19 @@ class Message extends Memcached_DataObject
             throw new ClientException(_('You are banned from sending direct messages.'));
         }
 
+        $user = User::staticGet('id', $sender->id);
+
         $msg = new Message();
 
         $msg->from_profile = $from;
         $msg->to_profile = $to;
-        $msg->content = common_shorten_links($content);
-        $msg->rendered = common_render_text($content);
+        if ($user) {
+            // Use the sender's URL shortening options.
+            $msg->content = $user->shortenLinks($content);
+        } else {
+            $msg->content = common_shorten_links($content);
+        }
+        $msg->rendered = common_render_text($msg->content);
         $msg->created = common_sql_now();
         $msg->source = $source;