From e6d93b251606e7261db3a5048cf730c2e69a28e3 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 20 Sep 2013 05:45:11 -0700 Subject: is_commentable() had some major issues when applied to the atrocity known as ConversationObject, hopefully this won't destabilise the network as it's a somewhat major permission tweak related to comments; also add any local clones to allowed_public_recips() as they should always be allowed recipients. Not sure what to do about host permissions in the event of clones. They have more than one host, and it isn't spelled out in the sent message. All of this stuff will make your head hurt. --- include/ConversationObject.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'include/ConversationObject.php') diff --git a/include/ConversationObject.php b/include/ConversationObject.php index 30026e908..5157dad05 100644 --- a/include/ConversationObject.php +++ b/include/ConversationObject.php @@ -138,22 +138,25 @@ class Conversation extends BaseObject { return false; } - if(local_user() && $item->get_data_value('uid') == local_user()) - $this->commentable = true; +// if(local_user() && $item->get_data_value('uid') == local_user()) +// $this->commentable = true; - if($this->writable) - $this->commentable = true; +// if($this->writable) +// $this->commentable = true; + + $item->set_commentable(false); + $ob_hash = (($this->observer) ? $this->observer['xchan_hash'] : ''); + + if(($item->get_data_value('author_xchan') === $ob_hash) || ($item->get_data_value('owner_xchan') === $ob_hash)) + $item->set_commentable(true); if($item->get_data_value('item_flags') & ITEM_NOCOMMENT) { - $this->commentable = false; + $item->set_commentable(false); } - elseif(($this->observer) && (! $this->writable)) { - $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$item->data); + elseif(($this->observer) && (! $item->is_commentable())) { + $item->set_commentable(can_comment_on_post($this->observer['xchan_hash'],$item->data)); } - - - $item->set_conversation($this); $this->threads[] = $item; return end($this->threads); -- cgit v1.2.3 From 110974eb55d58db26f1312d19ae4cdf09bbc796f Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 28 Sep 2013 04:41:12 -0700 Subject: fix can_comment_on_post when viewing wall-to-wall --- include/ConversationObject.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/ConversationObject.php') diff --git a/include/ConversationObject.php b/include/ConversationObject.php index 5157dad05..bf4300cb1 100644 --- a/include/ConversationObject.php +++ b/include/ConversationObject.php @@ -154,7 +154,10 @@ class Conversation extends BaseObject { $item->set_commentable(false); } elseif(($this->observer) && (! $item->is_commentable())) { - $item->set_commentable(can_comment_on_post($this->observer['xchan_hash'],$item->data)); + if((array_key_exists('owner',$item->data)) && ($item->data['owner']['abook_flags'] & ABOOK_FLAG_SELF)) + $item->set_commentable(perm_is_allowed($this->profile_owner,$this->observer['xchan_hash'],'post_comments')); + else + $item->set_commentable(can_comment_on_post($this->observer['xchan_hash'],$item->data)); } $item->set_conversation($this); -- cgit v1.2.3 From 6ca6bc2dd8cadb509ad84e184a11a80c6441921f Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 28 Sep 2013 05:03:58 -0700 Subject: close comment --- include/ConversationObject.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ConversationObject.php') diff --git a/include/ConversationObject.php b/include/ConversationObject.php index bf4300cb1..bb144d893 100644 --- a/include/ConversationObject.php +++ b/include/ConversationObject.php @@ -7,6 +7,7 @@ require_once('boot.php'); require_once('include/BaseObject.php'); require_once('include/ItemObject.php'); require_once('include/text.php'); +require_once('include/items.php'); /** * A list of threads -- cgit v1.2.3