Skip to content

Commit 22da41f

Browse files
committed
refactor: use clearer syntax to select popup settings
1 parent 59f3e52 commit 22da41f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lua/gitlab/actions/comment.lua

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,20 @@ M.create_comment_layout = function(opts)
198198
end
199199
end
200200

201-
local title = opts.discussion_id and "Reply" or opts.unlinked and "Note" or "Comment"
202-
203201
local popup_settings = state.settings.popup
204-
local overrides = opts.discussion_id ~= nil and popup_settings.reply
205-
or opts.unlinked and popup_settings.note
206-
or popup_settings.comment
207-
local settings = u.merge(popup_settings, overrides or {})
202+
local title
203+
local user_settings
204+
if opts.discussion_id ~= nil then
205+
title = "Reply"
206+
user_settings = popup_settings.reply
207+
elseif opts.unlinked then
208+
title = "Note"
209+
user_settings = popup_settings.note
210+
else
211+
title = "Comment"
212+
user_settings = popup_settings.comment
213+
end
214+
local settings = u.merge(popup_settings, user_settings or {})
208215

209216
M.current_win = vim.api.nvim_get_current_win()
210217
M.comment_popup = Popup(popup.create_popup_state(title, settings))

0 commit comments

Comments
 (0)