diff --git a/TGControlPanel/TestMergeManager.cs b/TGControlPanel/TestMergeManager.cs
index 69ac5c353d..d04e598c73 100644
--- a/TGControlPanel/TestMergeManager.cs
+++ b/TGControlPanel/TestMergeManager.cs
@@ -106,7 +106,7 @@ namespace TGControlPanel
if (alreadyMerged)
pulls.Remove(pull);
}
- InsertPullRequest(I, alreadyMerged);
+ InsertPullRequest(I, false, alreadyMerged);
}
//insert remaining merged pulls
@@ -132,23 +132,22 @@ namespace TGControlPanel
}
///
- /// Format an entry for and insert it into
+ /// Format an entry for and insert it into
///
- /// The to format
+ /// The to format, must contain a
+ /// If this or is , will be inserted at the top of as opposed to the bottom
/// If the item should be checked
- void InsertPullRequest(Issue I, bool isChecked)
+ void InsertPullRequest(Issue issue, bool prioritize, bool isChecked)
{
- if (I == null)
- return;
bool needsTesting = false;
- foreach (var J in I.Labels)
+ foreach (var J in issue.Labels)
if (J.Name.ToLower().Contains("test"))
{
needsTesting = true;
break;
}
- var itemString = String.Format("#{0} - {1}{2}", I.Number, I.Title, I.PullRequest.Merged ? " - MERGED ON REMOTE" : needsTesting ? " - TESTING REQUESTED" : "");
- InsertItem(itemString, needsTesting, isChecked);
+ var itemString = String.Format("#{0} - {1}{2}", issue.Number, issue.Title, issue.PullRequest != null && issue.PullRequest.Merged ? " - MERGED ON REMOTE" : needsTesting ? " - TESTING REQUESTED" : "");
+ InsertItem(itemString, prioritize || needsTesting, isChecked);
}
///
@@ -355,7 +354,13 @@ namespace TGControlPanel
if (pulls == null)
MessageBox.Show(String.Format(MergedPullsError, error));
//get the PR in question
- InsertPullRequest(await client.Issue.Get(repoName, repoOwner, PRNumber), pulls == null || pulls.Any(x => x.Number == PRNumber));
+ var PR = await client.Issue.Get(repoName, repoOwner, PRNumber);
+ if(PR == null ||PR.PullRequest == null)
+ {
+ MessageBox.Show("That doesn't seem to be a valid PR!");
+ return;
+ }
+ InsertPullRequest(PR, true, pulls == null || pulls.Any(x => x.Number == PRNumber));
}
finally
{