From ba2ce8a5ca1a3f97c610c6ffe5ed2eb155ab5566 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 4 Jun 2014 16:14:54 -0700 Subject: [PATCH] Fix undefinded $changesets when submitting inline comments in Differential Summary: Fixes T5262. This branch is overzealous, and causes us to fail to load changeses if `metamta.differential.unified-comment-context` is off. It was on for me locally for testing, which is why I missed this. Test Plan: No more exception. Reviewers: chad Reviewed By: chad Subscribers: richardvanvelzen, epriestley Maniphest Tasks: T5262 Differential Revision: https://secure.phabricator.com/D9376 --- .../editor/DifferentialTransactionEditor.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 0e8c3cfd98..9e06fb1da0 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -1284,19 +1284,20 @@ final class DifferentialTransactionEditor $changeset_ids[$id] = $id; } - if ($show_context) { - $hunk_parser = new DifferentialHunkParser(); - $changesets = id(new DifferentialChangesetQuery()) - ->setViewer($this->getActor()) - ->withIDs($changeset_ids) - ->needHunks(true) - ->execute(); - } + $changesets = id(new DifferentialChangesetQuery()) + ->setViewer($this->getActor()) + ->withIDs($changeset_ids) + ->needHunks(true) + ->execute(); $inline_groups = DifferentialTransactionComment::sortAndGroupInlines( $inlines, $changesets); + if ($show_context) { + $hunk_parser = new DifferentialHunkParser(); + } + $result = array(); foreach ($inline_groups as $changeset_id => $group) { $changeset = idx($changesets, $changeset_id);