Problem with assigning issues to users #2021
-
Description of the problem, including code/CLI snippetUnder the Gitlab API, in order to assign an issue to users, you must specify their user ID to the list Expected Behaviorfor index, assignees in enumerate(issue_assignees):
assignees.assignee_ids.append(user_id)
issue_assignees[index].save() The ticket is assigned to a provided Actual Behaviorissues = project.issues.list(state='opened')
for index, issue in enumerate(issues):
if not issue.assignees:
issue_assignees = get_group_members(stuff) //this is a custom function that I give it a group name, and it returns the IDs of the users in that group in a list e.g., [20, 40, 50, 21, 25]
t = []
for assignees in issue_assignees:
t.append(assignees.id)
issue.assignee_ids = t
issues[index].save() //on this line the issue at position index refreshes with no assignees And the ticket is not updated, nor is there a return code of an issue. Specifications
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Can you provide more context please? How was |
Beta Was this translation helpful? Give feedback.
-
Sorry, I'll add/update a more complete version to the report. |
Beta Was this translation helpful? Give feedback.
-
Maybe try something like this? issues = project.issues.list(state='opened')
for index, issue in enumerate(issues):
issue = project.issues.get(issue.id) # This may not be necessary but usually a good idea.
if not issue.assignees:
issue_assignees = get_group_members(stuff) //this is a custom function that I give it a group name, and it returns the IDs of the users in that group in a list e.g., [20, 40, 50, 21, 25]
else:
continue
t = []
for assignees in issue_assignees:
t.append(assignees.id)
issue.assignee_ids = t
issue.save()
issue = project.issues.get(issue.id)
issue.pprint() |
Beta Was this translation helpful? Give feedback.
-
Okay, apologies, I couldn't figure out the commit squashing, and rather than spin in circles for a few days while a simple doc update just needs to go in, I made a new branch with a single commit containing the changes: |
Beta Was this translation helpful? Give feedback.
Maybe try something like this?