-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add team option to author filter (#696)
Co-authored-by: Shine Lee <aungshine@gmail.com>
- Loading branch information
1 parent
a1d02ab
commit 903d5e8
Showing
5 changed files
with
106 additions
and
10 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
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
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
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
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,21 @@ | ||
const Teams = require('../../../validators/options_processor/teams') | ||
|
||
class TeamProcessor { | ||
static async process (context, filter, input, rule) { | ||
const userName = input | ||
const teamName = rule.team | ||
|
||
const SUCCESS_MESSAGE = `'${userName}' is part of the '${teamName}' team'` | ||
const FAILURE_MESSAGE = `'${userName}' is not part of the '${teamName}' team'` | ||
|
||
const teamMemberships = await Teams.extractTeamMemberships(context, [teamName], [userName]) | ||
const isMember = teamMemberships.includes(userName) | ||
|
||
return { | ||
status: isMember ? 'pass' : 'fail', | ||
description: isMember ? SUCCESS_MESSAGE : FAILURE_MESSAGE | ||
} | ||
} | ||
} | ||
|
||
module.exports = TeamProcessor |