Commit ebf21dba authored by Martin Matějek's avatar Martin Matějek

Clenup in api functions

parent c1454167
...@@ -65,15 +65,12 @@ class Api: ...@@ -65,15 +65,12 @@ class Api:
notif =, **notification_defaults) notif =, **notification_defaults)
# TODO: rethink/refactor def call_action(self, msgid, name):
def call_action(self, msgid, name, **kwargs):
"""Call action on notification""" """Call action on notification"""
n = self.notifications.get_notification(msgid) n = self.notifications.get_notification(msgid)
n.call_action(name) n.call_action(name)
if name == 'dismiss': if name == 'dismiss':
self.notifications.delete_message(msgid) self.notifications.remove(msgid)
def dismiss(self, msgid):
"""Dismiss specific notification"""
self.call_action(msgid, 'dismiss')
...@@ -87,16 +87,11 @@ class NotificationStorage: ...@@ -87,16 +87,11 @@ class NotificationStorage:
to_delete.append(n) to_delete.append(n)
for n in to_delete: for n in to_delete:
self.dismiss(n.notif_id) self.remove(n.notif_id)
logger.debug("Deleting notification '%s' due to timeout", n.notif_id) logger.debug("Deleting notification '%s' due to timeout", n.notif_id)
def delete_message(self, msgid): def remove(self, msgid):
"""Delete single notification""" """Remove single notification"""
def dismiss(self, msgid):
"""Dismiss single notification"""
# TODO: do it properly via builtin action
n = self.notifications[msgid] n = self.notifications[msgid]
del self.notifications[msgid] del self.notifications[msgid]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment