Skip to content

Commit

Permalink
labhub: Adapt to the modified newcomer process
Browse files Browse the repository at this point in the history
- `invite me` variation of invite command is removed.
- "Hello world"s no longer trigger invites.
- Newcomer invitation message is changed to show the modification in the
  newcomer process.

Closes #476
  • Loading branch information
meetmangukiya committed Dec 10, 2017
1 parent f3ba1ec commit 30f8063
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
17 changes: 5 additions & 12 deletions plugins/labhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ class LabHub(BotPlugin):
"""GitHub and GitLab utilities""" # Ignore QuotesBear

INVITE_SUCCESS = {
'newcomers': 'Welcome @{}! :tada:\n\nWe\'ve just sent you an invite'
' via email. Please accept it before proceeding forward.'
'\nTo get started, please follow our [newcomers guide]'
'(https://coala.io/newcomer). Most '
'newcomers': 'Welcome @{}! :tada:\n\n'
'Please go through https://coala.io/newcomer (skip '
'instructions about using corobo). Find your first issue '
'and ask one of the maintainers to assign you to it and '
'we\'ll invite you to the org. Most '
'issues will be explained there and in linked pages - it '
'will save you a lot of time, just read it. *Really.*\n\n'
'*Do not take an issue if you don\'t understand it on '
Expand Down Expand Up @@ -106,13 +107,6 @@ def invite_cmd(self, msg, match):
invitee = match.group(1)
inviter = msg.frm.nick

if invitee == 'me':
user = msg.frm.nick
self.send(msg.frm, self.INVITE_SUCCESS['newcomers'].format(user))
self.TEAMS[self.GH_ORG_NAME + ' newcomers'].invite(user)
self.invited_users.add(user)
return

team = 'newcomers' if match.group(2) is None else match.group(2)

self.log.info('{} invited {} to {}'.format(inviter, invitee, team))
Expand Down Expand Up @@ -143,7 +137,6 @@ def callback_message(self, msg):
# send the invite
self.send(msg.frm,
self.INVITE_SUCCESS['newcomers'].format(user))
self.TEAMS[self.GH_ORG_NAME + ' newcomers'].invite(user)
self.invited_users.add(user)

@re_botcmd(pattern=r'(?:new|file) issue ([\w\-\.]+?)(?: |\n)(.+?)(?:$|\n((?:.|\n)*))', # Ignore LineLengthBear, PyCodeStyleBear
Expand Down
3 changes: 1 addition & 2 deletions tests/labhub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def test_hello_world_callback(self):
# response.
with self.assertRaises(queue.Empty):
testbot.assertCommand('helloworld', 'newcomer')
self.mock_team.invite.assert_called_with(None)

def test_create_issue_cmd(self):
plugins.labhub.GitHub = create_autospec(IGitt.GitHub.GitHub.GitHub)
Expand Down Expand Up @@ -326,7 +325,7 @@ def test_invite_me(self):

plugins.labhub.os.environ['GH_TOKEN'] = 'patched?'
testbot.assertCommand('!invite me',
'We\'ve just sent you an invite')
'Find your first issue and ask one of the maintainers')
with self.assertRaises(queue.Empty):
testbot.pop_message()

Expand Down

0 comments on commit 30f8063

Please sign in to comment.