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

Feature/#21 add assignees on new issue #119

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

yoshio15
Copy link
Collaborator

@yoshio15 yoshio15 commented Mar 5, 2021

💪 Summary

working on #21.

🏁 Goals

fix to be able to set assignees when creating new issue.

yoshio15 added 5 commits March 5, 2021 22:17
- fix to be able to set assignee when creating new issue
- refactor: put some variables into one dictionary
- integrate `gh#provider#quickpick#open` to select assignees
autoload/gh/github/repos.vim Outdated Show resolved Hide resolved
skanehira and others added 7 commits March 6, 2021 10:10
remove white space in autoload/gh/issues.vim
- fix to be able to set assignee when creating new issue
- refactor: put some variables into one dictionary
- integrate `gh#provider#quickpick#open` to select assignees
let s:assignee_list_query =<< trim END
{
repository(name: "%s", owner: "%s") {
assignableUsers(first: 10) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to get all of repository's users
GraphQL can get 100 members but it's maybe not all in repository, so we need to use cursor to get when repository has over 100 members

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skanehira
sorry, i don't understand why we need to get users who are not assignable for the issue.
i guess getting only assignableUsers like this way is enough to show the list of assignable users on quickpick buffer.
something of my understanding is wrong...?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry my explanation is not good.
I mean I think we need to get assignable users for the issue more than 10.
But in GitHub specification, assign for 1 issue is until 10 users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for replying late... lol

ok, i got understand what you mean.
tried to fix by this commit.

Please check it again :)

endfunction

function! s:open_assignees_list(resp) abort
let s:issue_new_assignees = ["-"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the intent of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skanehira
I intended to express for 'assigning nobody' by this '-'.
if you don't want to add assignee on new issue, not selecting any item by in quickpick-buffer is not enough for assigning nobody. because the item which is on your cursor would be selected even if you don't selected an items by .

autoload/gh/provider/quickpick.vim in s:on_accept function around line 340 is the place.

      else
        let l:items = [s:state['fitems'][l:index]] " <= l:index is the cursor line
      endif

so, I placed '-' on top of the list.
then, when you not selecting in quickpick-buffer, the item '-' is selected(if you didn't move cursor in quickpick buffer), and s:on_accept_assignees function in gh/issues.vim remove that '-' and finally nobody assignees on new issue would be achieved.

this is the reason why i set '-' as default item.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intended to express for 'assigning nobody' by this '-'.
if you don't want to add assignee on new issue, not selecting any item by in quickpick-buffer is not enough for assigning nobody. because the item which is on your cursor would be selected even if you don't selected an items by .

How about implement cancel function?
I think if user do nothing, just close quickpick is better way.
As a result, operation and implement will be more simple because we don't need to remove - from list and user is just press <C-c> to close quickpick.

Copy link
Collaborator Author

@yoshio15 yoshio15 Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about implement cancel function?

i thought it would be better that the cancel function ( <C-c> ) should be able to cancel for creating new issue itself, not for selecting nobody as assignee, like below.

  1. vnew gh://:owner/:repo/issues/new
  2. Enter title of new issue.
  3. Select assignee(s). ( there should be 3 options for user )
  • Pattern A: <C-c>
    • => cancel creating new issue
  • Pattern B: Just put <CR> (without selecting)
    • => create new issue, but no assignee
  • Pattern C: Select assignee(s) and put <CR>
    • => create new issue with assignee(s)

How about this fix ?
I fixed autoload/gh/provider/quickpick.vim a little bit.

  • removed - from assignees list
  • user can select no assignee by just putting <CR> without selecting nobody

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern C: Select assignee(s) and put
=> create new issue with assignee(s)

I thought it's inconvenience a little bit when we choose how to merge the PR, because we must choose one.
How about implement like gh issue create? We can choose option to add some metadata.

image

Copy link
Collaborator Author

@yoshio15 yoshio15 Mar 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skanehira

I thought it's inconvenience a little bit when we choose how to merge the PR, because we must choose one.

sorry, I didn't consider it. I've got to understand.
I'll rebase revert the commit :)

How about implement like gh issue create ? We can choose option to add some metadata.

hmm, sorry. could you explain your idea, a bit more...?
implement like the picture (you posted), just before selecting assignees?

Copy link
Owner

@skanehira skanehira Mar 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement like the picture (you posted), just before selecting assignees?

In my image, operation is bellow.

  1. open create new issue buffer
  2. choose template (if existed)
  3. edit issue body and save with :w
  4. ask user what they want to add some metadata
    1. if they want, ask they what kind of metadata to add (like screenshot) with quickpick (labels, projects, milestone will implement in other issues)
    2. if they don't want, do nothing
  5. create new issue

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your explanation, I've got your image clearly :)
I'm gonna try to implement it.

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

Successfully merging this pull request may close these issues.

2 participants