diff options
author | zotlabs <mike@macgirvin.com> | 2016-10-25 16:21:56 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-10-25 16:21:56 -0700 |
commit | 084b41fc2c0e8abeec1da5c792ec552b5ae1ce8f (patch) | |
tree | b123a0bf7453a95f5b94caa22b8c7b4a746c003f /include/items.php | |
parent | 7b713e25768a36ea032b683eb1763578102166d0 (diff) | |
download | volse-hubzilla-084b41fc2c0e8abeec1da5c792ec552b5ae1ce8f.tar.gz volse-hubzilla-084b41fc2c0e8abeec1da5c792ec552b5ae1ce8f.tar.bz2 volse-hubzilla-084b41fc2c0e8abeec1da5c792ec552b5ae1ce8f.zip |
first cut at edit activities
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 43 |
1 files changed, 43 insertions, 0 deletions
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 |