From 06235a3aa36af671f956084d0f2c24ac9461f4e8 Mon Sep 17 00:00:00 2001 From: Joshua Judson Rosen Date: Mon, 8 Dec 2014 22:39:36 -0500 Subject: [PATCH] Consistently root autostitched conversations at the oldest notice. --- classes/Notice.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 9328a76bb8..ed3104de2b 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1271,10 +1271,16 @@ class Notice extends Managed_DataObject } // If this isn't a reply to anything, then it's its own - // root. + // root if it's the earliest notice in the conversation: if (empty($this->reply_to)) { - return $this; + $root = new Notice; + $root->conversation = $this->conversation; + $root->orderBy('notice.created ASC'); + $root->find(); + $root->fetch(); + $root->free(); + return $root; } if (is_null($profile)) {