jira-cli: Assigning issue to self doesn't assign it

Describe the bug

Running the following command doesn’t assign the issue to me, instead the user search opens up, in which I’m unfindable as well.

jira issue assign "TICKET-CODE" "$(jira me)"

Please provide following details

  1. JiraCLI Version:
    (Version="0.1.1", GitCommit="6663763b44a2e5d328b551ae7d2f1a37d1e232ae", GoVersion="go1.17.2", BuildDate="2021-11-03"", Compiler="gc", Platform="darwin/amd64")
    
  2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
    Jira Server v8.20.0
    
  3. What operating system are you using? Also mention version.
    macOS 12.0.1
    
  4. What terminal are you using? Also mention version.
    alacritty 0.9.0 (fed349a)
    

To Reproduce

Steps to reproduce the behavior:

  1. Run jira issue assign "TICKET-CODE" "$(jira me)"
  2. Issue isn’t assigned to you, user search is opened up
  3. Probably a separate issue but no names past the initial cropped list are findable

Expected behavior

The issue would be assigned to me.

Additional context

Not that it’s relevant here but I’m using the line in the following function:

# Move an issue back to progress
jmbk() {
  jira issue transition "$1" "Back To Progress"
  jira issue assign "$1" "$(jira me)"
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 23 (9 by maintainers)

Most upvoted comments

This should be fixed with #380

Yes, can confirm. This works as expected now.

jira issue assign "TICKET-CODE" "$(jira me)"

Thanks a lot!

thanks @ankitpokhrel! have just installed it and so far basic stuff is working. I’ll play with it a few days and let you know how it goes, but the basic problem of looking up my username seems to work well now

Hi, I found 2 or even 3 different issues here. 1st - using displayName instead of name if I change https://github.com/ankitpokhrel/jira-cli/blob/5429cbd9d36360ac88245a412d3672a1c023a2a9/pkg/jira/types.go#L120-L126 to

type User struct {
	AccountID   string `json:"accountId"`
	Email       string `json:"emailAddress"`
	DisplayName string `json:"displayName"`
	Name        string `json:"name"`
	Active      bool   `json:"active"`
}

I can successfully assign issue to myself.

2nd - according to documentation https://docs.atlassian.com/software/jira/docs/api/REST/8.20.1/#user-findAssignableUsers https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-user-search/#api-rest-api-2-user-assignable-search-get parameter “query” is not always available . For example I’m using Jira 8.20.1 and “query” doesn’t work for me. If I use “username” I can find user which I’m looking for. It works similar to “query” in newer version - can return multiple records.

3rd - Pagination doesn’t work as expected for me. It looks like a some kind of protection against downloading the user list /rest/api/2/user/assignable/search?project=PP&maxResults=1000&startAt=99 returns only 1 record even if there are more than 1000 users.

So, strangely enough I have observed the following: let us assume we cannot find user X and that such user is assignable to the project via JIRA UI.

  • by querying the API directly via curl I do not get user X as available
  • by replicating everything in the shoes of user X (namely user X uses your application with their own credentials) they are available in the list of assignable users

so it seems to me that the JIRA API returns results in different orders (or does not return some at all) according to who is invoking the API call. I remember seeing a similar behaviour in a project of mine when using the GitHub API, that one has to explicitly indicate how many results per page to return otherwise it may be inconsistent. This is however speculation, nevertheless it may be worth looking into a way to explicitly force pagination (if that even exists for JIRA).