From 130f37c4f8d8e44a7159c4c7249a787d33eeffdd Mon Sep 17 00:00:00 2001 From: Daniel Nieto Date: Fri, 17 Jan 2014 11:22:05 +0100 Subject: [PATCH 1/3] Add missing semicolon (;) --- app/lib/github/github-directives.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/github/github-directives.js b/app/lib/github/github-directives.js index 15ee083..e668695 100644 --- a/app/lib/github/github-directives.js +++ b/app/lib/github/github-directives.js @@ -174,7 +174,7 @@ angular.module('maks3w.github.directives', ['maks3w.github']) } _simpleMerge(pr, commitMsg, selectedBranches[0]); } else { - gitFlowMerge(pr, $scope.patchType + '/' + pr.number, commitMsg, 'master', 'develop') + gitFlowMerge(pr, $scope.patchType + '/' + pr.number, commitMsg, 'master', 'develop'); } }); }); From 8db4b769781c314dad6248ea258f0fa80aef5783 Mon Sep 17 00:00:00 2001 From: Daniel Nieto Date: Fri, 17 Jan 2014 11:24:21 +0100 Subject: [PATCH 2/3] Add new feature that allows to automatically select the correct milestone from the selected branch/branches. If you select MASTER, it would take de minor milestone, in other case, the second one (minor) --- app/lib/github/github-directives.js | 30 +++++++++++++++++++++++++++++ app/lib/github/github.js | 3 +++ 2 files changed, 33 insertions(+) diff --git a/app/lib/github/github-directives.js b/app/lib/github/github-directives.js index e668695..939c6dc 100644 --- a/app/lib/github/github-directives.js +++ b/app/lib/github/github-directives.js @@ -176,6 +176,36 @@ angular.module('maks3w.github.directives', ['maks3w.github']) } else { gitFlowMerge(pr, $scope.patchType + '/' + pr.number, commitMsg, 'master', 'develop'); } + + repository.getMilestones().then(function(milestones){ + + if(milestones.length == 0) + { + return; + } + milestones.sort(function(a,b){ + av = a.title.replace('.',''); + ab = b.title.replace('.',''); + return av - ab; + }); + + var selectedBranches = $scope.selectedBranches; + if (selectedBranches.indexOf('master') != -1 ) // PR goes against MASTER + { + milestoneNumber = milestones[0].number; + } + else + { + if(milestones.length < 2) // If only exists 1 milestone, do nothing + { + return; + } + milestoneNumber = milestones[1].number; + } + repository.updateIssue(pr.number, { + "milestone" : milestoneNumber + }); + }); }); }); }; diff --git a/app/lib/github/github.js b/app/lib/github/github.js index 78126bd..1be1311 100644 --- a/app/lib/github/github.js +++ b/app/lib/github/github.js @@ -92,6 +92,9 @@ angular.module('maks3w.github', ['restangular']) }, updateIssue: function (number, args) { return repoApi.one('issues', number).patch(args); + }, + getMilestones: function () { + return repoApi.all('milestones').getList(); } }; From a61034a5eebd9b3bb0cdae7c4a1c0348e9c229b2 Mon Sep 17 00:00:00 2001 From: Daniel Nieto Date: Fri, 17 Jan 2014 11:31:02 +0100 Subject: [PATCH 3/3] Remove unnecessary variable declaration (duplicated) --- app/lib/github/github-directives.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/lib/github/github-directives.js b/app/lib/github/github-directives.js index 939c6dc..b44e025 100644 --- a/app/lib/github/github-directives.js +++ b/app/lib/github/github-directives.js @@ -189,7 +189,6 @@ angular.module('maks3w.github.directives', ['maks3w.github']) return av - ab; }); - var selectedBranches = $scope.selectedBranches; if (selectedBranches.indexOf('master') != -1 ) // PR goes against MASTER { milestoneNumber = milestones[0].number;