Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

EVERYONE/ALL auto-add all reviewers

  • Loading branch information...
commit 059bbc6817c105b65be60b4e6c36b139286652a5 1 parent 1eb3f76
@jspiro jspiro authored
Showing with 11 additions and 4 deletions.
  1. +1 −0  README.md
  2. +10 −4 prviewer.coffee
View
1  README.md
@@ -10,6 +10,7 @@ This application provides an alternative interface to viewing pull requests on G
* Highlights PRs involving you
* Parses the last comment of a PR to set a status label
* If PR titles begin with reviewer names `foo:` or `foo/bar/baz:`, the names will be converted to GitHub usernames per the settings file
+* If PR titles begin with `everyone` or `all`, all reviewers will be added
* Lists everyone involved in commenting in a PR
* Shows and sorts by last update time
* Shows the source branch name
View
14 prviewer.coffee
@@ -30,7 +30,7 @@ argv = optimist
settings = JSON.parse fs.readFileSync argv._[0]
# Map of GitHub username -> Gravatar URL.
-# The URL might be null for names like 'WIP' and 'ALL'
+# The URL can be null for incorrect github usernames
usernameToAvatar = {}
# -------------------------------------------------------------------------
@@ -172,14 +172,20 @@ app.get '/', ensureAuthenticated, (req, res) ->
# Pull names from comments.
reviewers = {}
- # Convert title to reviewers.
+ # Extract reviewers from pull title.
if match = pull.title.match /^([\w\/]+): /
+ # Strip the names out of the title.
pull.title = pull.title.substr match[0].length
+
+ # Convert title to reviewers.
names = (n.toLowerCase() for n in match[1].split /\//)
# Convert "IAN/MARK" to ['statico', 'mlogan']
for name in names
- if name of settings.reviewers
+ if name in ['everyone', 'all']
+ # Add all reviewers.
+ reviewers[name] = true for _, name of settings.reviewers
+ else if name of settings.reviewers
reviewers[settings.reviewers[name]] = true
else
reviewers[name] = true
@@ -240,7 +246,7 @@ app.get '/', ensureAuthenticated, (req, res) ->
# Make sure we have avatars for everybody.
iterator = (username, cb2) ->
- if username in ['wip', 'all'] or username of usernameToAvatar
+ if username of usernameToAvatar
return cb2()
github.user.getFrom {
Please sign in to comment.
Something went wrong with that request. Please try again.