-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACHIEVEMENT] Added member achievement (#40)
* added member achievement * changed pullRequest.author to pullRequest.creator * fixed image extension * added pullrequest number to achievement title * fixed time to wait :-)
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var moment = require('moment'); | ||
|
||
var member = { | ||
name: 'Member?', | ||
check: function(pullRequest, shall) { | ||
if (isWaitingLongTime(pullRequest)) { | ||
|
||
var achieve = { | ||
avatar : 'images/achievements/member.achievement.jpg', | ||
name : 'Member pull request #' + pullRequest.number + '?', | ||
short : 'Member Commits? member Push? member PR? ohh I member', | ||
description : [ | ||
'A pull request you\'ve created 2 weeks ago', | ||
' is finally merged' | ||
].join(''), | ||
relatedPullRequest: pullRequest.id | ||
}; | ||
|
||
shall.grant(pullRequest.creator.username, achieve); | ||
} | ||
} | ||
}; | ||
|
||
function isWaitingLongTime(pullRequest) { | ||
var backThen = moment(pullRequest.createdOn); | ||
var now = moment(); | ||
|
||
return now.diff(backThen, 'weeks') > 2; | ||
} | ||
|
||
module.exports = member; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.