X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FMessage.php;h=484d1f724c09749637b802d3976e6a03f1a01e9b;hb=a76f0676317058a8c1e2fd14ac04c7cabcbed6a7;hp=fa0c5b31812411dd03b08da8a4867add45bb45ed;hpb=640e7e7c43fa8e9b1a8516b486e560df84bd9887;p=quix0rs-gnu-social.git diff --git a/classes/Message.php b/classes/Message.php index fa0c5b3181..484d1f724c 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -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;