Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Jan 17, 2014
2 parents d71f7cf + a61034a commit 64d2fef
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
31 changes: 30 additions & 1 deletion app/lib/github/github-directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,37 @@ 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');
}

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;
});

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
});
});
});
});
};
Expand Down
3 changes: 3 additions & 0 deletions app/lib/github/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

Expand Down

0 comments on commit 64d2fef

Please sign in to comment.