From bd83936e5dfa3f39f382e9b52f3cb28e19d5c2d0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Oct 2016 20:43:24 -0700 Subject: send "hidden" edit activities to networks which don't support edits themselves --- include/items.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index bb78af930..2357384de 100755 --- a/include/items.php +++ b/include/items.php @@ -4506,6 +4506,7 @@ function fix_attached_file_permissions($channel,$observer_hash,$body, function item_create_edit_activity($post) { + if((! $post) || (! $post['item'])) return; @@ -4513,6 +4514,13 @@ function item_create_edit_activity($post) { $new_item = $update_item; + $author = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($new_item['author_xchan']) + ); + if($author) + $item_author = $author[0]; + + $new_item['id'] = 0; $new_item['parent'] = 0; $new_item['mid'] = item_message_id(); @@ -4521,11 +4529,35 @@ function item_create_edit_activity($post) { $new_item['body'] .= "\n\n"; $new_item['body'] .= $update_item['body']; + + $new_item['sig'] = ''; $new_item['verb'] = ACTIVITY_UPDATE; $new_item['item_thread_top'] = 0; $new_item['created'] = $new_item['edited'] = datetime_convert(); + $new_item['obj'] = json_encode(array( + 'type' => (($update_item['item_thread_top']) ? ACTIVITY_OBJ_NOTE : ACTIVITY_OBJ_COMMENT), + 'id' => $update_item['mid'], + 'parent' => $update_item['parent_mid'], + 'link' => array(array('rel' => 'alternate','type' => 'text/html', 'href' => $update_item['plink'])), + 'title' => $update_item['title'], + 'content' => $update_item['body'], + 'created' => $update_item['created'], + 'edited' => $update_item['edited'], + 'author' => array( + 'name' => $item_author['xchan_name'], + 'address' => $item_author['xchan_addr'], + 'guid' => $item_author['xchan_guid'], + 'guid_sig' => $item_author['xchan_guid_sig'], + 'link' => array( + array('rel' => 'alternate', 'type' => 'text/html', 'href' => $item_author['xchan_url']), + array('rel' => 'photo', 'type' => $item_author['xchan_photo_mimetype'], 'href' => $item_author['xchan_photo_m'])), + ), + )); + + + $x = post_activity_item($new_item); $post_id = $x['id']; -- cgit v1.2.3