Skip to content

Commit fcf390a

Browse files
committed
Move the issue filter function
1 parent 09e4b25 commit fcf390a

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

lib/src/Gren.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class Gren {
183183
_createRelease(releaseOptions) {
184184
const loaded = utils.task(this, 'Preparing the release');
185185

186-
return this.repo._createRelease(releaseOptions)
186+
return this.repo.createRelease(releaseOptions)
187187
.then(response => {
188188
loaded();
189189
const release = response.data;
@@ -600,21 +600,6 @@ class Gren {
600600
return ignoreIssuesWith.some(label => labels.map(({ name }) => name).includes(label));
601601
}
602602

603-
/**
604-
* Filter the issue based on gren options and labels
605-
*
606-
* @since 0.9.0
607-
* @private
608-
*
609-
* @param {Object} issue
610-
*
611-
* @return {Boolean}
612-
*/
613-
_filterIssue(issue) {
614-
return !issue.pull_request && !this._lablesAreIgnored(issue.labels) &&
615-
!((this.options.onlyMilestones || this.options.dataSource === 'milestones') && !issue.milestone);
616-
}
617-
618603
/**
619604
* Get all the closed issues from the current repo
620605
*
@@ -632,14 +617,10 @@ class Gren {
632617
state: 'closed',
633618
since: releaseRanges[releaseRanges.length - 1][1].date
634619
})
635-
.then(response => {
620+
.then(({ data }) => {
636621
loaded();
637622

638-
const filteredIssues = response.data.filter(this._filterIssue.bind(this));
639-
640-
process.stdout.write(filteredIssues.length + ' issues found\n');
641-
642-
return filteredIssues;
623+
return data;
643624
});
644625
}
645626

@@ -723,6 +704,21 @@ class Gren {
723704
return this._templateGroups(groups);
724705
}
725706

707+
/**
708+
* Filter the issue based on gren options and labels
709+
*
710+
* @since 0.9.0
711+
* @private
712+
*
713+
* @param {Object} issue
714+
*
715+
* @return {Boolean}
716+
*/
717+
_filterIssue(issue) {
718+
return !issue.pull_request && !this._lablesAreIgnored(issue.labels) &&
719+
!((this.options.onlyMilestones || this.options.dataSource === 'milestones') && !issue.milestone);
720+
}
721+
726722
/**
727723
* Filter the issue based on the date range, or if is in the release
728724
* milestone.
@@ -763,9 +759,13 @@ class Gren {
763759
return this._getClosedIssues(releaseRanges)
764760
.then(issues => releaseRanges
765761
.map(range => {
766-
const filteredIssues = issues.filter(this._filterBlockIssue.bind(this, range));
762+
const filteredIssues = issues
763+
.filter(this._filterIssue.bind(this))
764+
.filter(this._filterBlockIssue.bind(this, range));
767765
const body = (!range[0].body || this.options.override) && this._groupBy(filteredIssues);
768766

767+
process.stdout.write(filteredIssues.length + ' issues found\n');
768+
769769
return {
770770
id: range[0].id,
771771
release: range[0].name,

0 commit comments

Comments
 (0)