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

inviteAssignees not working #3

Open
summbrooks opened this issue Jul 19, 2019 · 4 comments · May be fixed by #7
Open

inviteAssignees not working #3

summbrooks opened this issue Jul 19, 2019 · 4 comments · May be fixed by #7

Comments

@summbrooks
Copy link

I don't know if this is still maintained at all. I've found it extremely helpful, but I can't seem to get the inviteAssignees portion working. It's enabled but doesn't add attendees to events. I've turned on debugging, but no errors are thrown. I can query my gitlab API without issue, and calendar/event creation is working perfectly. I'll be very grateful for any suggestions to get my issue assignees on my events.

@PeterDaveHello
Copy link
Contributor

The last change date of calendar_manager.py file is on Apr 28, 2017, on May 22, 2017, GitLab 9.2 released with "Multiple Assignees for Issues" support: https://about.gitlab.com/releases/2017/05/22/gitlab-9-2-released/#multiple-assignees-for-issues, as a result:

Note that as part of this change, the assignee_id parameter in the issues API has been deprecated. The assignee_ids should be used instead. Also, the assignee object in the JSON response has been deprecated. The assignees array should be used instead.

As this issue was opened on Jul 20, 2019, I guess that you're using a newer version of GitLab instance, so that may be the reason why this feature is not working.

@PeterDaveHello
Copy link
Contributor

@summbrooks if you're not using multiple assignee feature on GitLab, a quick patch to make gitlab-calendar could be:

diff --git a/calendar_manager.py b/calendar_manager.py
index f34a486..c59f20f 100644
--- a/calendar_manager.py
+++ b/calendar_manager.py
@@ -121,14 +121,15 @@ def handle_event(data, service, gitlab, calIdMap, config):
         }
         
         # populate assignee field using email from gitlab, if feature is enabled
-        if 'assignee' in data:
+        if 'assignees' in data:
             if gitlab and config['gitlabApi']['inviteAssignees']:
                 body['attendees'].append({
-                    'email': gitlab.users.list(username=data['assignee']['username'])[0].email,
+                    'email': gitlab.users.list(username=data['assignees'][0]['username'])[0].email,
                     'responseStatus': 'accepted'
                 })
             else:
-                body['description'] += "\nAssignee: %s" % data['assignee']['username']
+                body['description'] += "\nAssignee: %s" % data['assignees'][0]['username']
         
         # call api to create issue
         e = service.events().insert(

@tmick0 tmick0 linked a pull request Oct 16, 2021 that will close this issue
@tmick0
Copy link
Owner

tmick0 commented Oct 16, 2021

Sorry for taking over two years to address this issue, but I have pushed a prospective fix (which handles multiple assignees) to #7 however I am unable to test it. If anyone can confirm this works I will merge the branch.

@PeterDaveHello
Copy link
Contributor

Cool, I also have a local patch that I'm testing it right now, will see if we can just use #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants