- Set the root of a new local conversation to a new conversation.id

- Output conversation URIs from conversation.uri
This commit is contained in:
Zach Copley 2010-02-17 01:12:13 -08:00
parent ed46a38ecf
commit 198c046c89
1 changed files with 18 additions and 15 deletions

View File

@ -309,7 +309,8 @@ class Notice extends Memcached_DataObject
// the beginning of a new conversation. // the beginning of a new conversation.
if (empty($notice->conversation)) { if (empty($notice->conversation)) {
$notice->conversation = $notice->id; $conv = Conversation::create();
$notice->conversation = $conv->id;
$changed = true; $changed = true;
} }
@ -331,14 +332,15 @@ class Notice extends Memcached_DataObject
return $notice; return $notice;
} }
function blowOnInsert() function blowOnInsert($conversation = false)
{ {
self::blow('profile:notice_ids:%d', $this->profile_id); self::blow('profile:notice_ids:%d', $this->profile_id);
self::blow('public'); self::blow('public');
if ($this->conversation != $this->id) { // XXX: Before we were blowing the casche only if the notice id
self::blow('notice:conversation_ids:%d', $this->conversation); // was not the root of the conversation. What to do now?
}
self::blow('notice:conversation_ids:%d', $this->conversation);
if (!empty($this->repeat_of)) { if (!empty($this->repeat_of)) {
self::blow('notice:repeats:%d', $this->repeat_of); self::blow('notice:repeats:%d', $this->repeat_of);
@ -1015,24 +1017,25 @@ class Notice extends Memcached_DataObject
} }
} }
if (!empty($this->conversation) if (!empty($this->conversation)) {
&& $this->conversation != $this->id) {
$xs->element( $conv = Conversation::staticGet('id', $this->conversation);
'link', array(
'rel' => 'ostatus:conversation', if (!empty($conv)) {
'href' => common_local_url( $xs->element(
'conversation', 'link', array(
array('id' => $this->conversation) 'rel' => 'ostatus:conversation',
) 'href' => $conv->uri
) )
); );
}
} }
$reply_ids = $this->getReplies(); $reply_ids = $this->getReplies();
foreach ($reply_ids as $id) { foreach ($reply_ids as $id) {
$profile = Profile::staticGet('id', $id); $profile = Profile::staticGet('id', $id);
if (!empty($profile)) { if (!empty($profile)) {
$xs->element( $xs->element(
'link', array( 'link', array(
'rel' => 'ostatus:attention', 'rel' => 'ostatus:attention',