Catch bad replyto IDs before saving a new notice to avoid a constraint violation. This happens, for example, when posting for the first time on a fresh install
This commit is contained in:
parent
3fd877c4ce
commit
35677336de
@ -152,6 +152,11 @@ class NewnoticeAction extends Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
$replyto = $this->trimmed('inreplyto');
|
$replyto = $this->trimmed('inreplyto');
|
||||||
|
#If an ID of 0 is wrongly passed here, it will cause a database error,
|
||||||
|
#so override it...
|
||||||
|
if ($replyto == 0) {
|
||||||
|
$replyto = 'false';
|
||||||
|
}
|
||||||
|
|
||||||
$notice = Notice::saveNew($user->id, $content, 'web', 1,
|
$notice = Notice::saveNew($user->id, $content, 'web', 1,
|
||||||
($replyto == 'false') ? null : $replyto);
|
($replyto == 'false') ? null : $replyto);
|
||||||
|
Loading…
Reference in New Issue
Block a user