Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

implement --assignee with relative and absolute additions #474

Merged
merged 6 commits into from
Jan 1, 2021
Merged

implement --assignee with relative and absolute additions #474

merged 6 commits into from
Jan 1, 2021

Conversation

maxice8
Copy link
Collaborator

@maxice8 maxice8 commented Dec 31, 2020

Description

  • feat(commands/cmdutils): add helper function to parse --assignee
  • feat(internal/utils): add helper functions to deal with []string
  • feat(commands/issue/update): add rudimentary --assignee support
  • test(internal/utils): implement tests for added helper functions

Related Issue

Resolves #467 (Need to implement for mr update)

How Has This Been Tested?

Against Leo/agl on gitlab.alpinelinux.org

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

@maxice8 maxice8 added the cmd: issue Related to issues management label Dec 31, 2020
@profclems
Copy link
Owner

I haven't been able to carefully review the commits but currently here is what happens:

  1. When adding an assignee (WORKS)

    ProfClems:  ~/.../profclems/glab  |update-assignees ✓|
    → glab issue update 2 -R glab-cli/test --assignee +profclems
    - Updating issue #2
    ✓ assigned "profclems"
    #2 Test Issue 2 (about 27 days ago)
    https://gitlab.com/glab-cli/test/-/issues/2
  2. When removing assignee (FAILS)

    ProfClems:  ~/.../profclems/glab  |update-assignees ✓|
    → glab issue update 2 -R glab-cli/test --assignee "!profclems"
    - Updating issue #2
    PUT https://gitlab.com/api/v4/projects/glab-cli/test/issues/2: 400 {error: assignee_id, assignee_ids, confidential, created_at, description, discussion_locked, due_date, labels, add_labels, remove_labels, milestone_id, state_event, title, weight, epic_id, epic_iid are missing, at least one parameter must be provided}
  3. When replacing assignee (FAILS)

    ProfClems:  ~/.../profclems/glab  |update-assignees ✓|
    → glab issue update 2 -R glab-cli/test --assignee "profclems"
    - Updating issue #2
    PUT https://gitlab.com/api/v4/projects/glab-cli/test/issues/2: 400 {error: assignee_id, assignee_ids, confidential, created_at, description, discussion_locked, due_date, labels, add_labels, remove_labels, milestone_id, state_event, title, weight, epic_id, epic_iid are missing, at least one parameter must be provided}
  4. When reassigning an already assigned user (FAILS):
    This one takes almost forever and later report error 500. That's from the API side but glab errs by reassigning an already assigned user

    ProfClems:  ~/.../profclems/glab  |update-assignees ✓|
    → glab issue update 2 -R glab-cli/test --assignee "+profclems"
    - Updating issue #2
    PUT https://gitlab.com/api/v4/projects/glab-cli/test/issues/2: 500 {message: 500 Internal Server Error}

@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 31, 2020

I think I got 2 and 3 fixed, I can't reproduce 4 in gitlab.alpinelinux.org

@profclems
Copy link
Owner

profclems commented Dec 31, 2020

Issue 4 still persists. Might be an issue with GitLab since it returns error 500

Steps to Reproduce:

  1. Assign a user to an issue with glab issue update <id> --assignee someuser
  2. Reassign user with glab issue update <id> --assignee +someuser

NOTE: It works if you're replacing (i.e. with no + prefix). So basically it sends []int{user.ID, user.ID} but GitLab is unable to handle the duplicates

@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 31, 2020

gitlab.alpinelinux.org works fine, can GitLab developers be notified ?

image

@profclems
Copy link
Owner

Oops! That's definitely a GitLab.com issue.

Maybe we could open an issue https://gitlab.com/gitlab-org/gitlab/-/issues

@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 31, 2020

Well I'm off to new year party

@profclems
Copy link
Owner

Well I'm off to new year party

Haha... Happy new year then 🎉.

It's still 11:27pm here

@maxice8
Copy link
Collaborator Author

maxice8 commented Dec 31, 2020

Well I'm off to new year party

Haha... Happy new year then 🎉.

It's still 11:27pm here

20:33 here but I like going early

@profclems profclems merged commit 392e284 into profclems:trunk Jan 1, 2021
@profclems profclems mentioned this pull request Jan 1, 2021
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cmd: issue Related to issues management size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow issue update and mr update to assign/unassign users
2 participants