forked from GNUsocial/gnu-social
static function definitions and minor simplifying
This commit is contained in:
parent
d63bca9d3c
commit
9fb3ea3ce6
@ -1203,17 +1203,15 @@ class Notice extends Managed_DataObject
|
|||||||
$this->_attachments[$this->id] = $attachments;
|
$this->_attachments[$this->id] = $attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
function publicStream($offset=0, $limit=20, $since_id=0, $max_id=0)
|
static function publicStream($offset=0, $limit=20, $since_id=null, $max_id=null)
|
||||||
{
|
{
|
||||||
$stream = new PublicNoticeStream();
|
$stream = new PublicNoticeStream();
|
||||||
return $stream->getNotices($offset, $limit, $since_id, $max_id);
|
return $stream->getNotices($offset, $limit, $since_id, $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function conversationStream($id, $offset=0, $limit=20, $since_id=null, $max_id=null)
|
||||||
function conversationStream($id, $offset=0, $limit=20, $since_id=0, $max_id=0)
|
|
||||||
{
|
{
|
||||||
$stream = new ConversationNoticeStream($id);
|
$stream = new ConversationNoticeStream($id);
|
||||||
|
|
||||||
return $stream->getNotices($offset, $limit, $since_id, $max_id);
|
return $stream->getNotices($offset, $limit, $since_id, $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1225,20 +1223,19 @@ class Notice extends Managed_DataObject
|
|||||||
*/
|
*/
|
||||||
function hasConversation()
|
function hasConversation()
|
||||||
{
|
{
|
||||||
if (!empty($this->conversation)) {
|
if (empty($this->conversation)) {
|
||||||
$conversation = Notice::conversationStream(
|
// this notice is not part of a conversation apparently
|
||||||
$this->conversation,
|
// FIXME: all notices should have a conversation value, right?
|
||||||
1,
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($conversation->N > 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$stream = new ConversationNoticeStream($this->conversation);
|
||||||
|
$notices = $stream->getNotices(/*offset*/ 1, /*limit*/ 1);
|
||||||
|
|
||||||
|
// if our "offset 1, limit 1" query got a result, return true else false
|
||||||
|
return $notice->N > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grab the earliest notice from this conversation.
|
* Grab the earliest notice from this conversation.
|
||||||
*
|
*
|
||||||
@ -1271,8 +1268,7 @@ class Notice extends Managed_DataObject
|
|||||||
$root = new Notice;
|
$root = new Notice;
|
||||||
$root->conversation = $this->conversation;
|
$root->conversation = $this->conversation;
|
||||||
$root->orderBy('notice.created ASC');
|
$root->orderBy('notice.created ASC');
|
||||||
$root->find();
|
$root->find(true); // true means "fetch first result"
|
||||||
$root->fetch();
|
|
||||||
$root->free();
|
$root->free();
|
||||||
return $root;
|
return $root;
|
||||||
}
|
}
|
||||||
@ -2193,7 +2189,7 @@ class Notice extends Managed_DataObject
|
|||||||
return $notice->fetchAll('id');
|
return $notice->fetchAll('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
function locationOptions($lat, $lon, $location_id, $location_ns, $profile = null)
|
static function locationOptions($lat, $lon, $location_id, $location_ns, $profile = null)
|
||||||
{
|
{
|
||||||
$options = array();
|
$options = array();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user