From 084b41fc2c0e8abeec1da5c792ec552b5ae1ce8f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Oct 2016 16:21:56 -0700 Subject: first cut at edit activities --- include/items.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 4c40d9430..cb8a00c33 100755 --- a/include/items.php +++ b/include/items.php @@ -4503,3 +4503,46 @@ function fix_attached_file_permissions($channel,$observer_hash,$body, } } } + + +function item_create_edit_activity($post) { + if((! $post) || (! $post['item'])) + return; + + $update_item = $post['item']; + + $new_item = $update_item; + + $new_item['id'] = 0; + $new_item['parent'] = 0; + $new_item['mid'] = item_message_id(); + + $new_item['body'] = sprintf( t('Edited %s'), (($update_item['item_thread_top']) ? t('Post','edit_activity') : t('Comment','edit_activity'))); + + $new_item['body'] .= "\n\n"; + $new_item['body'] .= $update_item['body']; + + $new_item['title'] = $update_item['title']; + + $new_item['verb'] = ACTIVITY_UPDATE; + $new_item['item_thread_top'] = 0; + + $x = post_activity_item($new_item); + + logger('posted edit activity'); + + $post_id = $x['id']; + if($post_id) { + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + build_sync_packet($new_item['uid'],array('item' => array(encode_item($sync_item[0],true)))); + } + } + + \Zotlabs\Daemon\Master::Summon(array('Notifier', 'edit_activity', $post_id)); + +} \ No newline at end of file -- cgit v1.2.3