Skip to content

Commit

Permalink
labhub: Fetch IGitt user objects
Browse files Browse the repository at this point in the history
Issue.assign and Issue.unassign now require a User object
instead of the username.

Closes coala#633
  • Loading branch information
jayvdb committed Oct 26, 2018
1 parent b9d569d commit b4d9a83
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions plugins/labhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,13 @@ def unassign_cmd(self, msg, match):
except KeyError:
yield 'Repository doesn\'t exist.'
else:
if user in iss.assignees:
iss.unassign(user)
if iss.repository.hoster == 'github':
user_obj = self.IGH.get_user(user)
elif iss.repository.hoster == 'github':

This comment has been minimized.

Copy link
@abhishalya

abhishalya Mar 4, 2019

Should be gitlab here.

user_obj = self.IGL.get_user(user)

if user_obj in iss.assignees:
iss.unassign(user_obj)
yield '@{}, you are unassigned now :+1:'.format(user)
else:
yield 'You are not an assignee on the issue.'
Expand Down Expand Up @@ -394,9 +399,14 @@ def eligible(user, iss):
except KeyError:
yield 'Repository doesn\'t exist.'
else:
if iss.repository.hoster == 'github':
user_obj = self.IGH.get_user(user)
elif iss.repository.hoster == 'github':

This comment has been minimized.

Copy link
@abhishalya

abhishalya Mar 4, 2019

Should be gitlab here.

user_obj = self.IGL.get_user(user)

if not iss.assignees:
if eligible(user, iss):
iss.assign(user)
iss.assign(user_obj)
yield ('Congratulations! You\'ve been assigned to the '
'issue. :tada:')
else:
Expand All @@ -406,7 +416,7 @@ def eligible(user, iss):
).render(
organization=self.GH_ORG_NAME,
)
elif user in iss.assignees:
elif user_obj in iss.assignees:
yield ('The issue is already assigned to you.')
else:
yield tenv().get_template(
Expand Down

0 comments on commit b4d9a83

Please sign in to comment.