File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
lua/gitlab/actions/draft_notes Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 108108--- and re-render it.
109109--- @param tree NuiTree
110110M .confirm_publish_draft = function (tree )
111+ if not git .check_current_branch_up_to_date_on_remote (vim .log .levels .ERROR ) then
112+ return
113+ end
111114 local current_node = tree :get_node ()
112115 local note_node = common .get_note_node (tree , current_node )
113116 local root_node = common .get_root_node (tree , current_node )
@@ -120,12 +123,16 @@ M.confirm_publish_draft = function(tree)
120123 --- @type integer
121124 local note_id = note_node .is_root and root_node .id or note_node .id
122125 local body = { note = note_id }
126+ local unlinked = tree .bufnr == require (" gitlab.actions.discussions" ).unlinked_bufnr
123127 job .run_job (" /mr/draft_notes/publish" , " POST" , body , function (data )
124128 u .notify (data .message , vim .log .levels .INFO )
125-
126- local discussions = require (" gitlab.actions.discussions" )
127- local unlinked = tree .bufnr == discussions .unlinked_bufnr
128129 M .rebuild_view (unlinked )
130+ end , function ()
131+ M .rebuild_view (unlinked )
132+ u .notify (
133+ " Draft may have been published despite the error. Check the discussion tree." ,
134+ vim .log .levels .WARN
135+ )
129136 end )
130137end
131138
You can’t perform that action at this time.
0 commit comments