]> git.mxchange.org Git - friendica.git/blobdiff - object/Conversation.php
Merge branch 'master' of https://github.com/friendica/friendica into threaded_items
[friendica.git] / object / Conversation.php
index d8d14589d2d2f7256399daeeaf7e3136242b46a7..f4f9c09720d43fa1f4ed78cef331d6817493a969 100644 (file)
@@ -15,7 +15,7 @@ require_once('include/text.php');
 class Conversation extends BaseObject {
        private $threads = array();
        private $mode = null;
-       private $writeable = false;
+       private $writable = false;
        private $profile_owner = 0;
 
        public function __construct($mode) {
@@ -35,15 +35,15 @@ class Conversation extends BaseObject {
                        case 'network':
                        case 'notes':
                                $this->profile_owner = local_user();
-                               $this->writeable = true;
+                               $this->writable = true;
                                break;
                        case 'profile':
                                $this->profile_owner = $a->profile['profile_uid'];
-                               $this->writeable = can_write_wall($a,$this->profile_owner);
+                               $this->writable = can_write_wall($a,$this->profile_owner);
                                break;
                        case 'display':
                                $this->profile_owner = $a->profile['uid'];
-                               $this->writeable = can_write_wall($a,$this->profile_owner);
+                               $this->writable = can_write_wall($a,$this->profile_owner);
                                break;
                        default:
                                logger('[ERROR] Conversation::set_mode : Unhandled mode ('. $mode .').', LOGGER_DEBUG);
@@ -61,10 +61,10 @@ class Conversation extends BaseObject {
        }
 
        /**
-        * Check if page is writeable
+        * Check if page is writable
         */
-       public function is_writeable() {
-               return $this->writeable;
+       public function is_writable() {
+               return $this->writable;
        }
 
        /**
@@ -91,6 +91,18 @@ class Conversation extends BaseObject {
                        logger('[WARN] Conversation::add_thread : Thread already exists ('. $item->get_id() .').', LOGGER_DEBUG);
                        return false;
                }
+
+               /*
+                * Only add will be displayed
+                */
+               if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
+                       logger('[WARN] Conversation::add_thread : Thread is a mail ('. $item->get_id() .').', LOGGER_DEBUG);
+                       return false;
+               }
+               if($item->get_data_value('verb') === ACTIVITY_LIKE || $item->get_data_value('verb') === ACTIVITY_DISLIKE) {
+                       logger('[WARN] Conversation::add_thread : Thread is a (dis)like ('. $item->get_id() .').', LOGGER_DEBUG);
+                       return false;
+               }
                $item->set_conversation($this);
                $this->threads[] = $item;
                return end($this->threads);