Skip to content

Commit

Permalink
feat(notification): configure skip_history from notification config
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hui committed Dec 12, 2023
1 parent 93d944f commit 580b4e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/fidget/notification.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ local logger = require("fidget.logger")
---@field warn_annote string|nil Default annotation for warn items
---@field error_annote string|nil Default annotation for error items
---@field priority number|nil Order in which group should be displayed; defaults to `50`
---@field skip_history boolean|nil Whether messages should be preserved in history

--- Notification element containing a message and optional annotation.
---
Expand Down
12 changes: 11 additions & 1 deletion lua/fidget/notification/model.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ function M.update(now, configs, state, msg, level, opts)
end
return
end

local skip_history = false
if group.config.skip_history ~= nil then
skip_history = group.config.skip_history
end
if opts.skip_history ~= nil then
skip_history = opts.skip_history
end
---@cast skip_history boolean

---@type Item
local new_item = {
key = opts.key,
Expand All @@ -206,7 +216,7 @@ function M.update(now, configs, state, msg, level, opts)
style = style_from_level(group.config, level) or group.config.annote_style or "Question",
hidden = opts.hidden or false,
expires_at = compute_expiry(now, opts.ttl, group.config.ttl),
skip_history = opts.skip_history or false,
skip_history = skip_history,
removed = false,
last_updated = now,
data = opts.data,
Expand Down

0 comments on commit 580b4e4

Please sign in to comment.