From 77d33ec7beda9841888e53c255e5a654a94184f1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 5 Dec 2015 10:05:46 -0800 Subject: [PATCH] Fix confusing ordering of similar actions in transaction groups Summary: Fixes T7250. Currently, if a display group of transactions (multiple transactions by the same author in a short period of time with no intervening comments) has several transactions of similar strength (e.g., several status change transactions) we can end up displaying them in reverse chronological order, which is confusing. Instead, make sure transactions of the same type/strength are always in logical order. Test Plan: - Merged a task into another task, then reopened the merged task. - Before patch: merge/reopen showed in wrong order. {F1014954} - After patch: merge/reopen show in correct order. {F1014955} Reviewers: chad Reviewed By: chad Maniphest Tasks: T7250 Differential Revision: https://secure.phabricator.com/D14680 --- .../PhabricatorApplicationTransactionView.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php index 7c3c8125b7..875d46699f 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -383,9 +383,19 @@ class PhabricatorApplicationTransactionView extends AphrontView { } foreach ($groups as $key => $group) { - $group = msort($group, 'getActionStrength'); - $group = array_reverse($group); - $groups[$key] = $group; + $results = array(); + + // Sort transactions within the group by action strength, then by + // within actions of similar strength. + $strength_groups = mgroup($group, 'getActionStrength'); + krsort($strength_groups); + foreach ($strength_groups as $strength_group) { + foreach (msort($strength_group, 'getID') as $xaction) { + $results[] = $xaction; + } + } + + $groups[$key] = $results; } return $groups;