From 7eb138c200edd4ce7e068b58736d37da89bbf87b Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 4 Jan 2016 15:01:17 +0100 Subject: [PATCH] Adding command to send notification messages --- CHANGELOG.md | 7 ++-- taiga/events/management/__init__.py | 0 .../commands/emit_notification_message.py | 34 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 taiga/events/management/__init__.py create mode 100644 taiga/events/management/commands/emit_notification_message.py diff --git a/CHANGELOG.md b/CHANGELOG.md index a377e771..d67e35c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Improve the django admin panel, now it is more usable and all the selector fields works properly. - [API] Add tribe_gig field to user stories (improve integration between Taiga and Taiga Tribe). - [API] Performance improvements for project stats. +- [Events] Add command to send an instant notifications to all the currently online users. - Lots of small and not so small bugfixes. @@ -24,7 +25,8 @@ - US, tasks and Issues can be upvoted or downvoted and the voters list can be obtained. - Now users can watch public issues, tasks and user stories. - Add endpoints to show the watchers list for issues, tasks and user stories. -- Add a "field type" property for custom fields: 'text', 'multiline text' and 'date' right now (thanks to [@artlepool](https://github.com/artlepool)). +- Add a "field type" property for custom fields: 'text', 'multiline text' and 'date' right nowi + (thanks to [@artlepool](https://github.com/artlepool)). - Allow multiple actions in the commit messages. - Now every user that coments USs, Issues or Tasks will be involved in it (add author to the watchers list). - Now profile timelines only show content about the objects (US/Tasks/Issues/Wiki pages) you are involved. @@ -50,7 +52,8 @@ - API: Improve and fix some errors in issues/filters_data and userstories/filters_data. - API: resolver suport ref GET param and return a story, task or issue. - Webhooks: Add deleted datetime to webhooks responses when isues, tasks or USs are deleted. -- Add headers to allow threading for notification emails about changes to issues, tasks, user stories, and wiki pages. (thanks to [@brett](https://github.com/brettp)). +- Add headers to allow threading for notification emails about changes to issues, tasks, user stories, + and wiki pages. (thanks to [@brett](https://github.com/brettp)). - Lots of small and not so small bugfixes. diff --git a/taiga/events/management/__init__.py b/taiga/events/management/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/taiga/events/management/commands/emit_notification_message.py b/taiga/events/management/commands/emit_notification_message.py new file mode 100644 index 00000000..4d075e92 --- /dev/null +++ b/taiga/events/management/commands/emit_notification_message.py @@ -0,0 +1,34 @@ +# Copyright (C) 2014-2016 Andrey Antukh +# Copyright (C) 2014-2016 Jesús Espino +# Copyright (C) 2014-2016 David Barragán +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django.core.management.base import BaseCommand + +from taiga.events.events import emit_event + +class Command(BaseCommand): + help = 'Send a notification message to the current users' + + def add_arguments(self, parser): + parser.add_argument("title", help="The title of the message.") + parser.add_argument("description", help="The description of the message.") + + def handle(self, **options): + data = { + "title": options["title"], + "desc": options["description"], + } + routing_key = "notifications" + emit_event(data, routing_key)