mirror of
https://github.com/friendica/friendica
synced 2024-12-23 13:20:21 +00:00
Ensure the parent field isn't set during Item insertion
- Avoid a database error if a null value is provided
This commit is contained in:
parent
c36ca3cffe
commit
a9d114316d
1 changed files with 3 additions and 2 deletions
|
@ -1734,7 +1734,6 @@ class Item
|
||||||
// Update the contact relations
|
// Update the contact relations
|
||||||
Contact\Relation::store($toplevel_parent['author-id'], $item['author-id'], $item['created']);
|
Contact\Relation::store($toplevel_parent['author-id'], $item['author-id'], $item['created']);
|
||||||
|
|
||||||
unset($item['parent']);
|
|
||||||
unset($item['parent_origin']);
|
unset($item['parent_origin']);
|
||||||
} else {
|
} else {
|
||||||
$parent_id = 0;
|
$parent_id = 0;
|
||||||
|
@ -1777,11 +1776,13 @@ class Item
|
||||||
$item['parent'] = $parent_id;
|
$item['parent'] = $parent_id;
|
||||||
Hook::callAll('post_local', $item);
|
Hook::callAll('post_local', $item);
|
||||||
unset($item['edit']);
|
unset($item['edit']);
|
||||||
unset($item['parent']);
|
|
||||||
} else {
|
} else {
|
||||||
Hook::callAll('post_remote', $item);
|
Hook::callAll('post_remote', $item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set after the insert because top-level posts are self-referencing
|
||||||
|
unset($item['parent']);
|
||||||
|
|
||||||
if (!empty($item['cancel'])) {
|
if (!empty($item['cancel'])) {
|
||||||
Logger::log('post cancelled by addon.');
|
Logger::log('post cancelled by addon.');
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue