Merge pull request #1883 from annando/1509-addon-remote-self

Bugfix: "remote self" items weren't posted by connectors
This commit is contained in:
Tobias Diekershoff 2015-09-08 06:47:27 +02:00
commit 6b744aa71c

View file

@ -1209,8 +1209,13 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
} }
} }
if ($notify)
$guid_prefix = "";
else
$guid_prefix = $arr['network'];
$arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0); $arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0);
$arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $arr['network'])); $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $guid_prefix));
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']); $arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']);
$arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : ''); $arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : '');
$arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : ''); $arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : '');
@ -1423,6 +1428,9 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
// Fill the cache field // Fill the cache field
put_item_in_cache($arr); put_item_in_cache($arr);
if ($notify)
call_hooks('post_local',$arr);
else
call_hooks('post_remote',$arr); call_hooks('post_remote',$arr);
if(x($arr,'cancel')) { if(x($arr,'cancel')) {
@ -1569,6 +1577,9 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
$r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post)); $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
if (count($r) == 1) { if (count($r) == 1) {
if ($notify)
call_hooks('post_local_end', $r[0]);
else
call_hooks('post_remote_end', $r[0]); call_hooks('post_remote_end', $r[0]);
} else } else
logger('item_store: new item not found in DB, id ' . $current_post); logger('item_store: new item not found in DB, id ' . $current_post);