Merge branch '0.7.x' into 0.8.x
This commit is contained in:
commit
e0bdaa787d
@ -125,7 +125,12 @@ class Notice extends Memcached_DataObject
|
|||||||
|
|
||||||
$profile = Profile::staticGet($profile_id);
|
$profile = Profile::staticGet($profile_id);
|
||||||
|
|
||||||
$final = common_shorten_links($content);
|
$final = common_shorten_links($content);
|
||||||
|
|
||||||
|
if (mb_strlen($final) > 140) {
|
||||||
|
common_log(LOG_INFO, 'Rejecting notice that is too long.');
|
||||||
|
return _('Problem saving notice. Too long.');
|
||||||
|
}
|
||||||
|
|
||||||
if (!$profile) {
|
if (!$profile) {
|
||||||
common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
|
common_log(LOG_ERR, 'Problem saving notice. Unknown user.');
|
||||||
|
@ -66,7 +66,13 @@ class MailerDaemon
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$msg = $this->cleanup_msg($msg);
|
$msg = $this->cleanup_msg($msg);
|
||||||
$this->add_notice($user, $msg);
|
$err = $this->add_notice($user, $msg);
|
||||||
|
if (is_string($err)) {
|
||||||
|
$this->error($from, $err);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function error($from, $msg)
|
function error($from, $msg)
|
||||||
@ -130,17 +136,15 @@ class MailerDaemon
|
|||||||
|
|
||||||
function add_notice($user, $msg)
|
function add_notice($user, $msg)
|
||||||
{
|
{
|
||||||
// should test
|
|
||||||
// $msg_shortened = common_shorten_links($msg);
|
|
||||||
// if (mb_strlen($msg_shortened) > 140) ERROR and STOP
|
|
||||||
$notice = Notice::saveNew($user->id, $msg, 'mail');
|
$notice = Notice::saveNew($user->id, $msg, 'mail');
|
||||||
if (is_string($notice)) {
|
if (is_string($notice)) {
|
||||||
$this->log(LOG_ERR, $notice);
|
$this->log(LOG_ERR, $notice);
|
||||||
return;
|
return $notice;
|
||||||
}
|
}
|
||||||
common_broadcast_notice($notice);
|
common_broadcast_notice($notice);
|
||||||
$this->log(LOG_INFO,
|
$this->log(LOG_INFO,
|
||||||
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
|
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_message($fname)
|
function parse_message($fname)
|
||||||
|
Loading…
Reference in New Issue
Block a user