From 5396f3c9d12ce1a9059cdf2edeedc1cc9e6c8db7 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Fri, 16 Jul 2021 17:34:48 +0100 Subject: [PATCH] [DirectMessage] Fix some wrong calls after MessageModel introduction in d9a9a3746b --- plugins/DirectMessage/lib/messagecommand.php | 8 ++++---- plugins/GroupPrivateMessage/classes/Group_message.php | 6 +++--- plugins/GroupPrivateMessage/forms/groupmessage.php | 2 +- scripts/createsim.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/DirectMessage/lib/messagecommand.php b/plugins/DirectMessage/lib/messagecommand.php index 5912e3df57..8f6dedd9bb 100644 --- a/plugins/DirectMessage/lib/messagecommand.php +++ b/plugins/DirectMessage/lib/messagecommand.php @@ -36,14 +36,14 @@ class MessageCommand extends Command $this->text = $this->user->shortenLinks($this->text); - if (Message::contentTooLong($this->text)) { + if (MessageModel::contentTooLong($this->text)) { // XXX: i18n. Needs plural support. // TRANS: Message given if content is too long. %1$sd is used for plural. // TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters. $channel->error($this->user, sprintf(_m('Message too long - maximum is %1$d character, you sent %2$d.', 'Message too long - maximum is %1$d characters, you sent %2$d.', - Message::maxContent()), - Message::maxContent(), mb_strlen($this->text))); + MessageModel::maxContent()), + MessageModel::maxContent(), mb_strlen($this->text))); return; } @@ -61,7 +61,7 @@ class MessageCommand extends Command return; } try { - $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source()); + $message = MessageModel::saveNew(Profile::getByID($this->user->id), $this->text, $channel->source()); $message->notify(); // TRANS: Message given have sent a direct message to another user. // TRANS: %s is the name of the other user. diff --git a/plugins/GroupPrivateMessage/classes/Group_message.php b/plugins/GroupPrivateMessage/classes/Group_message.php index 921677cb59..45d1c6c05c 100644 --- a/plugins/GroupPrivateMessage/classes/Group_message.php +++ b/plugins/GroupPrivateMessage/classes/Group_message.php @@ -98,16 +98,16 @@ class Group_message extends Managed_DataObject // We use the same limits as for 'regular' private messages. - if (Message::contentTooLong($text)) { + if (MessageModel::contentTooLong($text)) { // TRANS: Exception thrown when trying to send group private message that is too long. // TRANS: %d is the maximum meggage length. throw new Exception(sprintf( _m( 'That\'s too long. Maximum message size is %d character.', 'That\'s too long. Maximum message size is %d characters.', - Message::maxContent() + MessageModel::maxContent() ), - Message::maxContent() + MessageModel::maxContent() )); } diff --git a/plugins/GroupPrivateMessage/forms/groupmessage.php b/plugins/GroupPrivateMessage/forms/groupmessage.php index c33e4b25a2..0e441db577 100644 --- a/plugins/GroupPrivateMessage/forms/groupmessage.php +++ b/plugins/GroupPrivateMessage/forms/groupmessage.php @@ -133,7 +133,7 @@ class GroupMessageForm extends Form 'name' => 'content'), ($this->content) ? $this->content : ''); - $contentLimit = Message::maxContent(); + $contentLimit = MessageModel::maxContent(); if ($contentLimit > 0) { $this->out->elementStart('dl', 'form_note'); diff --git a/scripts/createsim.php b/scripts/createsim.php index 0e6d807442..393ebe680e 100755 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -207,7 +207,7 @@ function newMessage($i) $other = $friends[$j]; - $message = Message::saveNew($user->id, $other->id, $content, 'createsim'); + $message = MessageModel::saveNew(Profile::getByID($user->id), $content, 'createsim'); }*/ function newSub($i)