[DirectMessage] Fix some wrong calls after MessageModel introduction in d9a9a3746b

This commit is contained in:
Diogo Peralta Cordeiro 2021-07-16 17:34:48 +01:00
parent 55293e4008
commit bdb4c54fa8
4 changed files with 9 additions and 9 deletions

View File

@ -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.

View File

@ -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()
));
}

View File

@ -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');

View File

@ -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)