}
/**
- * Factory method for creating a new conversation
+ * Factory method for creating a new conversation.
+ *
+ * Use this for locally initiated conversations. Remote notices should
+ * preferrably supply their own conversation URIs in the OStatus feed.
*
* @return Conversation the new conversation DO
*/
$conv = new Conversation();
$conv->created = common_sql_now();
$conv->id = $notice->id;
- $conv->uri = common_local_url('conversation', array('id' => $notice->id), null, null, false);
+ $conv->uri = sprintf('%s%s=%d:%s=%s',
+ TagURI::mint(),
+ 'noticeId', $notice->id,
+ 'objectType', 'thread');
$result = $conv->insert();
if ($result === false) {
return common_local_url('conversation', array('id' => $this->id)) .
($noticeId===null ? '' : "#notice-{$noticeId}");
}
+
+ // FIXME: ...will 500 ever be too low? Taken from ConversationAction::MAX_NOTICES
+ public function getNotices($offset=0, $limit=500, Profile $scoped=null)
+ {
+ if ($scoped === null) {
+ $scoped = Profile::current();
+ }
+ $stream = new ConversationNoticeStream($this->id, $scoped);
+ $notices = $stream->getNotices($offset, $limit);
+ return $notices;
+ }
}