-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #482 from NickLaMuro/triage-team-label-exceptions
[AddLabel/RemoveLabel] Allow triage team to add all labels
- Loading branch information
Showing
10 changed files
with
403 additions
and
27 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
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,36 @@ | ||
module IsTeamMember | ||
def triage_member?(username) | ||
IsTeamMember.triage_team_members.include?(username) | ||
end | ||
|
||
# List of usernames for the traige team | ||
# | ||
# Cache triage_team_members, and refresh cache every 24 hours | ||
# | ||
# Note: This is created as a class method | ||
# | ||
cache_with_timeout(:triage_team_members, 24 * 60 * 60) do | ||
if member_organization_name && triage_team_name | ||
team = GithubService.org_teams(member_organization_name) | ||
.detect { |t| t.name == triage_team_name } | ||
|
||
if team.nil? | ||
[] | ||
else | ||
GithubService.team_members(team.id).map(&:login) | ||
end | ||
else | ||
[] | ||
end | ||
end | ||
|
||
module_function | ||
|
||
def triage_team_name | ||
@triage_team_name ||= Settings.triage_team_name || nil | ||
end | ||
|
||
def member_organization_name | ||
@member_organization_name ||= Settings.member_organization_name || nil | ||
end | ||
end |
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
Oops, something went wrong.