1
0
Fork 0

Fix: Notes can be posted again. Never use "defaults" with "false" (#5551)

This commit is contained in:
Michael Vogel 2018-08-04 16:06:36 +02:00 committed by Hypolite Petovan
commit 810c108297
4 changed files with 20 additions and 6 deletions

View file

@ -135,7 +135,13 @@ function item_post(App $a) {
$app = strip_tags(defaults($_REQUEST, 'source', ''));
$extid = strip_tags(defaults($_REQUEST, 'extid', ''));
$object = defaults($_REQUEST, 'object', '');
$wall = intval(defaults($_REQUEST, 'wall', 1));
// Don't use "defaults" here. It would turn 0 to 1
if (!isset($_REQUEST['wall'])) {
$wall = 1;
} else {
$wall = $_REQUEST['wall'];
}
// Ensure that the user id in a thread always stay the same
if (!is_null($parent_user) && in_array($parent_user, [local_user(), 0])) {
@ -560,7 +566,12 @@ function item_post(App $a) {
// even if the post arrived via API we are considering that it
// originated on this site by default for determining relayability.
$origin = intval(defaults($_REQUEST, 'origin', 1));
// Don't use "defaults" here. It would turn 0 to 1
if (!isset($_REQUEST['origin'])) {
$origin = 1;
} else {
$origin = $_REQUEST['origin'];
}
$notify_type = ($parent ? 'comment-new' : 'wall-new');