aboutsummaryrefslogtreecommitdiffstats
path: root/include/ConversationObject.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-07-08 22:01:57 -0700
committerfriendica <info@friendica.com>2013-07-08 22:01:57 -0700
commit6e012839c9807ce8c3c97bafdca7a36cf5fc58a9 (patch)
treeb3bbb574e058a45ed7d2658a3bc710704164d751 /include/ConversationObject.php
parentcd40802229a39fe6eabc2dec8784a445e4cd2769 (diff)
downloadvolse-hubzilla-6e012839c9807ce8c3c97bafdca7a36cf5fc58a9.tar.gz
volse-hubzilla-6e012839c9807ce8c3c97bafdca7a36cf5fc58a9.tar.bz2
volse-hubzilla-6e012839c9807ce8c3c97bafdca7a36cf5fc58a9.zip
more work on bug #59 - hope this doesn't hork everything. Also some tweaking of the theme for the new radius control, which produced some surprising results when expert mode was toggled.
Diffstat (limited to 'include/ConversationObject.php')
-rw-r--r--include/ConversationObject.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/include/ConversationObject.php b/include/ConversationObject.php
index 7cf39f757..e3b46ca3f 100644
--- a/include/ConversationObject.php
+++ b/include/ConversationObject.php
@@ -11,12 +11,14 @@ require_once('include/text.php');
/**
* A list of threads
*
- * We should think about making this a SPL Iterator
*/
+
class Conversation extends BaseObject {
private $threads = array();
private $mode = null;
+ private $observer = null;
private $writable = false;
+ private $commentable = false;
private $profile_owner = 0;
private $preview = false;
@@ -34,8 +36,8 @@ class Conversation extends BaseObject {
$a = $this->get_app();
- $observer = $a->get_observer();
- $ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+ $this->observer = $a->get_observer();
+ $ob_hash = (($this->observer) ? $this->observer['xchan_hash'] : '');
switch($mode) {
case 'network':
@@ -63,7 +65,6 @@ class Conversation extends BaseObject {
break;
}
$this->mode = $mode;
-
}
/**
@@ -80,6 +81,10 @@ class Conversation extends BaseObject {
return $this->writable;
}
+ public function is_commentable() {
+ return $this->commentable;
+ }
+
/**
* Check if page is a preview
*/
@@ -101,6 +106,10 @@ class Conversation extends BaseObject {
$this->set_mode($mode);
}
+ public function get_observer() {
+ return $this->observer;
+ }
+
/**
* Add a thread to the conversation
@@ -121,12 +130,21 @@ class Conversation extends BaseObject {
}
/*
- * Only add will be displayed
+ * Only add things that will be displayed
*/
- if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
+
+ if(($item->get_data_value('id') != $item->get_data_value('parent')) && (activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE))) {
return false;
}
+
+ if(local_user() && $item->get_data_value('uid') == local_user())
+ $this->commentable = true;
+
+ if(($this->observer) && (! $this->writable)) {
+ $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$item['data']);
+ }
+
$item->set_conversation($this);
$this->threads[] = $item;
return end($this->threads);