fixed enabled field type for services table
All checks were successful
dreamfall/clacksme/pipeline/head This commit looks good
All checks were successful
dreamfall/clacksme/pipeline/head This commit looks good
This commit is contained in:
parent
57af4f3c8d
commit
8412effa6d
2 changed files with 5 additions and 7 deletions
|
@ -96,19 +96,16 @@ class MailboxNotifier(object):
|
|||
|
||||
def on_notify(self):
|
||||
self.log.info("Triggering notifications")
|
||||
text = f"New messages have been recieved at {self.mailbox.imap_user}"
|
||||
text = f"New messages have been received at {self.mailbox.imap_user}"
|
||||
targets = Services.select().where(Services.user == self.mailbox.user)
|
||||
for target in targets:
|
||||
|
||||
if target.service == "pushover" and target.enabled:
|
||||
self.send_pushover(target.target, text)
|
||||
|
||||
elif target.service == "mattermost" and target.enabled:
|
||||
if target.service == "mattermost" and target.enabled:
|
||||
self.send_mattermost(target.target, text)
|
||||
|
||||
else:
|
||||
self.log.info("unknown notifiaction service")
|
||||
|
||||
def send_pushover(self, po_user, text):
|
||||
notifier = Notifier.get(Notifier.service == "pushover")
|
||||
url = "https://api.pushover.net/1/messages.json"
|
||||
|
@ -179,7 +176,8 @@ def main():
|
|||
for mailbox in Mailbox.select():
|
||||
imap_process = MailboxNotifier(mailbox)
|
||||
p = Process(
|
||||
target=imap_process.start, name=mailbox.user, args=(log_queue,event_queue,))
|
||||
target=imap_process.start, name=mailbox.user,
|
||||
args=(log_queue,event_queue,))
|
||||
processes.append(p)
|
||||
p.daemon = True
|
||||
p.start()
|
||||
|
|
|
@ -37,7 +37,7 @@ class Services(BaseModel):
|
|||
user = CharField()
|
||||
service = CharField()
|
||||
target = CharField()
|
||||
enabled = CharField(default=True)
|
||||
enabled = BooleanField(default=True)
|
||||
|
||||
def create_tables():
|
||||
tables = [System, Mailbox, Events, Notifier, Services]
|
||||
|
|
Loading…
Reference in a new issue