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

Clenup in api functions

parent c1454167
......@@ -65,15 +65,12 @@ class Api:
notif = Notification.new(skel, **notification_defaults)
self.notifications.store(notif)
# TODO: rethink/refactor
def call_action(self, msgid, name, **kwargs):
def call_action(self, msgid, name):
"""Call action on notification"""
self.delete_invalid_messages()
n = self.notifications.get_notification(msgid)
n.call_action(name)
if name == 'dismiss':
self.notifications.delete_message(msgid)
def dismiss(self, msgid):
"""Dismiss specific notification"""
self.call_action(msgid, 'dismiss')
self.notifications.remove(msgid)
......@@ -87,16 +87,11 @@ class NotificationStorage:
to_delete.append(n)
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)
def delete_message(self, msgid):
"""Delete single notification"""
self.dismiss(msgid)
def dismiss(self, msgid):
"""Dismiss single notification"""
# TODO: do it properly via builtin action
def remove(self, msgid):
"""Remove single notification"""
n = 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