preserve event item[uri] if present

This commit is contained in:
friendica
2013-01-20 15:36:04 -08:00
parent 45be26dd81
commit 127b605f32
5 changed files with 65 additions and 42 deletions

View File

@@ -901,16 +901,18 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
$ev['uid'] = $channel['channel_id'];
$ev['account'] = $channel['channel_account_id'];
$ev['edited'] = $arr['edited'];
$ev['uri'] = $arr['uri'];
$ev['private'] = $arr['item_private'];
// is this an edit?
$r = q("SELECT * FROM event left join item on resource_id = event_hash WHERE resource_type = 'event' and
`uri` = '%s' AND event.uid = %d LIMIT 1",
$r = q("SELECT resource_id FROM item where uri = '%s' and uid = %d and resource_type = 'event' limit 1",
dbesc($arr['uri']),
intval($channel['channel_id'])
);
if($r)
$ev['event_hash'] = $r[0]['event_hash'];
if($r) {
$ev['event_hash'] = $r[0]['resource_id'];
}
dbg(1);
$xyz = event_store($ev);
dbg(0);