Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify slack about a new tester signing up #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ To secure your webpage, you only have to set the `ITC_TOKEN` environment variabl
- `ITC_CLOSED_TEXT` Set this text to temporary disable enrollment of new beta testers
- `RESTRICTED_DOMAIN` Set this domain (in the format `domain.com`) to restrict users with emails in another domain from signing up. This list supports multiple domains by setting it to a comma delimited list (`domain1.com,domain2.com`)
- `FASTLANE_ITC_TEAM_NAME` If you're in multiple teams, enter the name of your iTC team here. Make sure it matches.
- `SLACK_WEBHOOK_URL` If you want boarding to sent you a notification about a new tester using slack enter a Slack WebHook URL here

## Custom Domain

Expand Down
11 changes: 11 additions & 0 deletions app/controllers/invite_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spaceship'
require 'slack-notifier'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add the slack-notifier gem to the gem file too 😄

class InviteController < ApplicationController
before_action :set_app_details
before_action :check_disabled_text
Expand Down Expand Up @@ -92,6 +93,7 @@ def submit
logger.info "Addding tester to application"
app.default_external_group.add_tester!(tester)
logger.info "Done"
notify_slack(first_name,last_name,email)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny minor nit, lets get spaces after the ',' for the args

end

if testing_is_live?
Expand Down Expand Up @@ -187,4 +189,13 @@ def testing_is_live?
end
return false
end

def notify_slack(first_name,last_name,email)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here: spaces after the ',' for the args

if ENV["SLACK_WEBHOOK_URL"]
notifier = Slack::Notifier.new ENV["SLACK_WEBHOOK_URL"], username: "Boarding Bot"

notifier.ping text: "Added new tester to TestFlight App #{app_metadata[:title]}: #{first_name} #{last_name}", icon_emoji: ":airplane:"
end
end

end