Skip to content

Commit

Permalink
use current_repo_only over current_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 committed Feb 6, 2025
1 parent 223662c commit 4a29c46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ require"octo".setup({
always_select_remote_on_create = false -- always give prompt to select base remote repo when creating PRs
},
notifications = {
current_repo = false, -- show notifications for current repo only
current_repo_only = false, -- show notifications for current repo only
},
file_panel = {
size = 10, -- changed files panel rows
Expand Down
13 changes: 11 additions & 2 deletions lua/octo/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ local M = {}
---@field order_by OctoConfigOrderBy

---@class OctoConfigNotifications
---@field current_repo boolean
---@field current_repo_only boolean

---@class OctoConfigPR
---@field order_by OctoConfigOrderBy
Expand Down Expand Up @@ -155,7 +155,7 @@ function M.get_default_values()
},
},
notifications = {
current_repo = false,
current_repo_only = false,
},
reviews = {
auto_show_threads = true,
Expand Down Expand Up @@ -436,6 +436,14 @@ function M.validate_config()
validate_type(config.pull_requests.always_select_remote_on_create, "always_select_remote_on_create", "boolean")
end

local function validate_notifications()
if not validate_type(config.notifications, "notifications", "table") then
err("notifications", "Expected notifications to be a table")
return
end
validate_type(config.notifications.current_repo_only, "notifications.current_repo_only", "boolean")
end

local function validate_mappings()
-- TODO(jarviliam): Validate each keymap
if not validate_type(config.mappings, "mappings", "table") then
Expand Down Expand Up @@ -486,6 +494,7 @@ function M.validate_config()
validate_issues()
validate_reviews()
validate_pull_requests()
validate_notifications()
if validate_type(config.file_panel, "file_panel", "table") then
validate_type(config.file_panel.size, "file_panel.size", "number")
validate_type(config.file_panel.use_icons, "file_panel.use_icons", "boolean")
Expand Down
2 changes: 1 addition & 1 deletion lua/octo/pickers/telescope/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ function M.notifications(opts)
opts = opts or {}
local cfg = octo_config.values

if cfg.notifications.current_repo then
if cfg.notifications.current_repo_only then
opts.repo = utils.get_remote_name()
end

Expand Down

0 comments on commit 4a29c46

Please sign in to comment.