[CORE] Add new Notice scope for private messaging
Notice: - Add MESSAGE_SCOPE scope lib/*.stream: - Filter out notices with MESSAGE_SCOPE scope
This commit is contained in:
		@@ -93,7 +93,7 @@ class Notice extends Managed_DataObject
 | 
			
		||||
                'object_type' => array('type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams object type', 'default' => null),
 | 
			
		||||
                'verb' => array('type' => 'varchar', 'length' => 191, 'description' => 'URI representing activity streams verb', 'default' => 'http://activitystrea.ms/schema/1.0/post'),
 | 
			
		||||
                'scope' => array('type' => 'int',
 | 
			
		||||
                                 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = followers; null = default'),
 | 
			
		||||
                                 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = followers; 16 = messages; null = default'),
 | 
			
		||||
            ),
 | 
			
		||||
            'primary key' => array('id'),
 | 
			
		||||
            'unique keys' => array(
 | 
			
		||||
@@ -136,6 +136,7 @@ class Notice extends Managed_DataObject
 | 
			
		||||
    const ADDRESSEE_SCOPE = 2;
 | 
			
		||||
    const GROUP_SCOPE     = 4;
 | 
			
		||||
    const FOLLOWER_SCOPE  = 8;
 | 
			
		||||
    const MESSAGE_SCOPE   = 16;
 | 
			
		||||
 | 
			
		||||
    protected $_profile = array();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -127,6 +127,8 @@ class RawInboxNoticeStream extends FullNoticeStream
 | 
			
		||||
            $notice->whereAdd(sprintf('notice.id <= %d', $max_id));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE);
 | 
			
		||||
 | 
			
		||||
        self::filterVerbs($notice, $this->selectVerbs);
 | 
			
		||||
 | 
			
		||||
        $notice->limit($offset, $limit);
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,7 @@ class RawNetworkPublicNoticeStream extends FullNoticeStream
 | 
			
		||||
        // -1 == blacklisted, -2 == gateway (i.e. Twitter)
 | 
			
		||||
        $notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
 | 
			
		||||
        $notice->whereAdd('is_local !='. Notice::GATEWAY);
 | 
			
		||||
        $notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE);
 | 
			
		||||
 | 
			
		||||
        Notice::addWhereSinceId($notice, $since_id);
 | 
			
		||||
        Notice::addWhereMaxId($notice, $max_id);
 | 
			
		||||
 
 | 
			
		||||
@@ -127,6 +127,8 @@ class RawProfileNoticeStream extends NoticeStream
 | 
			
		||||
        $notice->selectAdd();
 | 
			
		||||
        $notice->selectAdd('id');
 | 
			
		||||
 | 
			
		||||
        $notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE);
 | 
			
		||||
 | 
			
		||||
        Notice::addWhereSinceId($notice, $since_id);
 | 
			
		||||
        Notice::addWhereMaxId($notice, $max_id);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -79,6 +79,7 @@ class RawPublicNoticeStream extends FullNoticeStream
 | 
			
		||||
 | 
			
		||||
        // This feed always gives only local activities.
 | 
			
		||||
        $notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
 | 
			
		||||
        $notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE);
 | 
			
		||||
 | 
			
		||||
        Notice::addWhereSinceId($notice, $since_id);
 | 
			
		||||
        Notice::addWhereMaxId($notice, $max_id);
 | 
			
		||||
 
 | 
			
		||||
@@ -101,6 +101,8 @@ class RawReplyNoticeStream extends NoticeStream
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $reply->whereAdd('notice.scope != ' . NOTICE::MESSAGE_SCOPE);
 | 
			
		||||
 | 
			
		||||
        $reply->orderBy('reply.modified DESC, reply.notice_id DESC');
 | 
			
		||||
 | 
			
		||||
        if (!is_null($offset)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user