naughty: Set a default reason in `:destroy()`.

Fix #2713
This commit is contained in:
Emmanuel Lepage Vallee 2019-03-02 12:59:24 -05:00
parent 4930978424
commit b0cf594de5
2 changed files with 4 additions and 0 deletions

View File

@ -360,6 +360,8 @@ end
-- Remove the notification from the internal list(s)
local function cleanup(self, reason)
assert(reason, "Use n:destroy() instead of emitting the signal directly")
if properties.suspended then
for k, v in pairs(naughty.notifications.suspended) do
if v == self then

View File

@ -249,6 +249,8 @@ function notification:destroy(reason, keep_visible)
return false
end
reason = reason or cst.notification_closed_reason.dismissed_by_user
self:emit_signal("destroyed", reason, keep_visible)
self._private.is_destroyed = true