- Notifications
You must be signed in to change notification settings - Fork675
Problem with assigning issues to users#2021
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
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 Behaviorforindex,assigneesinenumerate(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')forindex,issueinenumerate(issues):ifnotissue.assignees:issue_assignees=get_group_members(stuff)//thisisacustomfunctionthatIgiveitagroupname,anditreturnstheIDsoftheusersinthatgroupinaliste.g., [20,40,50,21,25]t= []forassigneesinissue_assignees:t.append(assignees.id)issue.assignee_ids=tissues[index].save()//onthislinetheissueatpositionindexrefresheswithnoassignees And the ticket is not updated, nor is there a return code of an issue. Specifications
|
BetaWas this translation helpful?Give feedback.
All reactions
Maybe try something like this?
issues=project.issues.list(state='opened')forindex,issueinenumerate(issues):issue=project.issues.get(issue.id)# This may not be necessary but usually a good idea.ifnotissue.assignees:issue_assignees=get_group_members(stuff)//thisisacustomfunctionthatIgiveitagroupname,anditreturnstheIDsoftheusersinthatgroupinaliste.g., [20,40,50,21,25]else:continuet= []forassigneesinissue_assignees:t.append(assignees.id)issue.assignee_ids=tissue.save()issue=project.issues.get(issue.id)issue.pprint()
Replies: 4 comments 6 replies
-
Can you provide more context please? How was |
BetaWas this translation helpful?Give feedback.
All reactions
-
Sorry, I'll add/update a more complete version to the report. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Maybe try something like this? issues=project.issues.list(state='opened')forindex,issueinenumerate(issues):issue=project.issues.get(issue.id)# This may not be necessary but usually a good idea.ifnotissue.assignees:issue_assignees=get_group_members(stuff)//thisisacustomfunctionthatIgiveitagroupname,anditreturnstheIDsoftheusersinthatgroupinaliste.g., [20,40,50,21,25]else:continuet= []forassigneesinissue_assignees:t.append(assignees.id)issue.assignee_ids=tissue.save()issue=project.issues.get(issue.id)issue.pprint() |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Great to hear you got it working! So it is documented here:https://docs.gitlab.com/ee/api/issues.html#edit-issue If you would like to do a PR to help improve the As a note it appears that |
BetaWas this translation helpful?Give feedback.
All reactions
-
Okay, so that actually helps me understand the docsa little better. Because essentially what you've got is any time Gitlab makes a change to that api, you're automatically adjusting for it by letting the user add new parameters on the fly. But yes, I'm happy to contribute to the project in that way. I'll get a branch together for review. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
So I have some documentation written out following the contributors guide, but I don't have permission to push a branch up. |
BetaWas this translation helpful?Give feedback.
All reactions
-
@MichaelSweikata you can contribute from a fork :) |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Ah ha! Thank you. Haven't contributed this way before, so, thanks for pointing that out. I'll have to read up on Forking Workflows. |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
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: |
BetaWas this translation helpful?Give feedback.
All reactions
This discussion was converted from issue #2020 on May 16, 2022 16:48.