Skip to content

Commit

Permalink
Merge pull request #19 from unlimitedlabs/slack_welcome_message
Browse files Browse the repository at this point in the history
Fix slack welcome message display bug and add user handle
  • Loading branch information
jrbotros committed Sep 23, 2015
2 parents 6a65d0d + 86391ed commit bf8936b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions orchestra/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def __init__(self, api_key):
def add_worker_to_project_team(worker, project):
slack = SlackService(settings.SLACK_EXPERTS_API_KEY)
try:
response = slack.groups.invite(project.slack_group_id,
slack.users.get_user_id(
worker.slack_username))
if not response.body['already_in_group']:
welcome_message = ('{} has been added to the team. '
'Welcome aboard!').format(worker.user.username)
user_id = slack.users.get_user_id(worker.slack_username)
response = slack.groups.invite(project.slack_group_id, user_id)
if not response.body.get('already_in_group'):
welcome_message = (
'<@{}|{}> has been added to the team. '
'Welcome aboard!').format(user_id, worker.slack_username)
slack.chat.post_message(project.slack_group_id, welcome_message)
except:
# TODO(jrbotros): for now, using slack on a per-worker basis is
Expand Down

0 comments on commit bf8936b

Please sign in to comment.