X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FMessage.php;h=484d1f724c09749637b802d3976e6a03f1a01e9b;hb=8b0f45d0a715fd25beb0aef9d42de3b91c5cd1ca;hp=16d0c60b304704bf69dd63e002f1162d11657786;hpb=797a0d79fbf4e105ee4ccdce093c1595c1f08a4a;p=quix0rs-gnu-social.git diff --git a/classes/Message.php b/classes/Message.php index 16d0c60b30..484d1f724c 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -38,19 +38,26 @@ class Message extends Memcached_DataObject } static function saveNew($from, $to, $content, $source) { - $sender = Profile::staticGet('id', $from); if (!$sender->hasRight(Right::NEWMESSAGE)) { + // TRANS: Client exception thrown when a user tries to send a direct message while being banned from sending them. 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; @@ -58,6 +65,7 @@ class Message extends Memcached_DataObject if (!$result) { common_log_db_error($msg, 'INSERT', __FILE__); + // TRANS: Message given when a message could not be stored on the server. return _('Could not insert message.'); } @@ -68,6 +76,7 @@ class Message extends Memcached_DataObject if (!$result) { common_log_db_error($msg, 'UPDATE', __FILE__); + // TRANS: Message given when a message could not be updated on the server. return _('Could not update message with new URI.'); }