diff options
author | friendica <info@friendica.com> | 2013-06-29 02:04:44 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-06-29 02:04:44 -0700 |
commit | 28e0665caddb84598ab2fc74abcd70267d3be7f1 (patch) | |
tree | 18bdc3a1fc83808ba7d186411b7ba21bce573f69 /include | |
parent | 6fba7ac1aff92e327357d21b00e8919e041d8395 (diff) | |
download | volse-hubzilla-28e0665caddb84598ab2fc74abcd70267d3be7f1.tar.gz volse-hubzilla-28e0665caddb84598ab2fc74abcd70267d3be7f1.tar.bz2 volse-hubzilla-28e0665caddb84598ab2fc74abcd70267d3be7f1.zip |
doc update, plus possible fix to "complex delivery chains" issue. Basically when the top-level post creator replies to a thread he sent to a forum via tags, it isn't getting redelivered to the forum members.
Diffstat (limited to 'include')
-rw-r--r-- | include/ItemObject.php | 9 | ||||
-rwxr-xr-x | include/items.php | 41 |
2 files changed, 40 insertions, 10 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php index 1205ae13e..fc4db3ecf 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -45,17 +45,8 @@ class Item extends BaseObject { if(($this->observer) && (! $this->writable)) { $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$data); -// if(! $this->commentable) { -// logger('commentable: ' . $data['comment_policy']); -// $this->commentable = true; -// } } -// logger('writable: ' . $this->writable); -// logger('commentable: ' . $this->commentable . ' uid=' . $this->data['uid'] . ' observer=' . $this->observer['xchan_hash']); -// if(get_config('system','thread_allow') && $a->theme_thread_allow && !$this->is_toplevel()) -// $this->threaded = true; - // Prepare the children if(count($data['children'])) { foreach($data['children'] as $item) { diff --git a/include/items.php b/include/items.php index c4d2a86af..0f260c8d2 100755 --- a/include/items.php +++ b/include/items.php @@ -1883,9 +1883,48 @@ function tag_deliver($uid,$item_id) { logger('tag_deliver: tag permission denied for ' . $u[0]['channel_address']); } + // This might be a followup by the original post author to a tagged forum + // If so setup a second delivery chain + + $r = null; + + if( ! ($item['item_flags'] & ITEM_THREAD_TOP)) { + $x = q("select * from item where id = parent and parent = %d and uid = %d limit 1", + intval($item['parent']), + intval($uid) + ); + if(($x) && ($x[0]['item_flags'] & ITEM_UPLINK) && ($x[0]['author_xchan'] == $item['author_xchan'])) { + logger('tag_deliver: creating second delivery chain for owner comment.'); + + // now change this copy of the post to a forum head message and deliver to all the tgroup members + // also reset all the privacy bits to the forum default permissions + + $private = (($u[0]['allow_cid'] || $u[0]['allow_gid'] || $u[0]['deny_cid'] || $u[0]['deny_gid']) ? 1 : 0); + + $flag_bits = ITEM_WALL|ITEM_ORIGIN; + + $r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s', + deny_cid = '%s', deny_gid = '%s', item_private = %d where id = %d limit 1", + intval($flag_bits), + dbesc($u[0]['channel_hash']), + dbesc($u[0]['allow_cid']), + dbesc($u[0]['allow_gid']), + dbesc($u[0]['deny_cid']), + dbesc($u[0]['deny_gid']), + intval($private), + intval($item_id) + ); + if($r) + proc_run('php','include/notifier.php','tgroup',$item_id); + else + logger('tag_deliver: failed to update item'); + } + } + $terms = get_terms_oftype($item['term'],TERM_MENTION); - logger('tag_deliver: post mentions: ' . print_r($terms,true), LOGGER_DATA); + if($terms) + logger('tag_deliver: post mentions: ' . print_r($terms,true), LOGGER_DATA); $link = normalise_link($a->get_baseurl() . '/channel/' . $u[0]['channel_address']); |