From c4e7b5c74421d925da37bd7068a808fd0734a36b Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 31 Mar 2023 22:10:19 +0800 Subject: [PATCH] feat(github.vim): update issue_edit function --- bundle/github.vim/autoload/github/api/issues.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bundle/github.vim/autoload/github/api/issues.vim b/bundle/github.vim/autoload/github/api/issues.vim index 82917e8ca..6e7aa021a 100644 --- a/bundle/github.vim/autoload/github/api/issues.vim +++ b/bundle/github.vim/autoload/github/api/issues.vim @@ -123,11 +123,19 @@ endfunction " Edit an issue " PATCH /repos/:owner/:repo/issues/:number function! github#api#issues#Edit(owner,repo,num,user,password,issue) abort + if empty(a:password) || empty(a:user) return github#api#util#Get('repos/' . a:owner . '/' . a:repo . '/issues/' . a:num, \ ['-X', 'PATCH', \ '-H', 'Accept: application/vnd.github.symmetra-preview+json', \ '-d', json_encode(a:issue), \ '-u', a:user . ':' . a:password]) + else + return github#api#util#Get('repos/' . a:owner . '/' . a:repo . '/issues/' . a:num, + \ ['-X', 'PATCH', + \ '-H', 'Accept: application/vnd.github.symmetra-preview+json', + \ '-d', json_encode(a:issue) + \ ] + github#api#authorize()) + endif endfunction ""