Adding deleted datetime to webhook sent info when deleting elements
parent
66a3398c33
commit
f6f3a5a0af
|
@ -18,6 +18,7 @@
|
||||||
- API: Mixin fields 'users', 'members' and 'memberships' in ProjectDetailSerializer.
|
- API: Mixin fields 'users', 'members' and 'memberships' in ProjectDetailSerializer.
|
||||||
- API: Add stats/system resource with global server stats (total project, total users....)
|
- API: Add stats/system resource with global server stats (total project, total users....)
|
||||||
- API: Improve and fix some errors in issues/filters_data and userstories/filters_data.
|
- API: Improve and fix some errors in issues/filters_data and userstories/filters_data.
|
||||||
|
- Webhooks: Add deleted datetime to webhooks responses when isues, tasks or USs are deleted.
|
||||||
- Lots of small and not so small bugfixes.
|
- Lots of small and not so small bugfixes.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from taiga.projects.history import services as history_service
|
from taiga.projects.history import services as history_service
|
||||||
from taiga.projects.history.choices import HistoryType
|
from taiga.projects.history.choices import HistoryType
|
||||||
|
@ -54,7 +55,7 @@ def on_new_history_entry(sender, instance, created, **kwargs):
|
||||||
extra_args = [instance]
|
extra_args = [instance]
|
||||||
elif instance.type == HistoryType.delete:
|
elif instance.type == HistoryType.delete:
|
||||||
task = tasks.delete_webhook
|
task = tasks.delete_webhook
|
||||||
extra_args = []
|
extra_args = [timezone.now()]
|
||||||
|
|
||||||
for webhook in webhooks:
|
for webhook in webhooks:
|
||||||
args = [webhook["id"], webhook["url"], webhook["key"], obj] + extra_args
|
args = [webhook["id"], webhook["url"], webhook["key"], obj] + extra_args
|
||||||
|
|
|
@ -112,11 +112,12 @@ def create_webhook(webhook_id, url, key, obj):
|
||||||
|
|
||||||
|
|
||||||
@app.task
|
@app.task
|
||||||
def delete_webhook(webhook_id, url, key, obj):
|
def delete_webhook(webhook_id, url, key, obj, deleted_date):
|
||||||
data = {}
|
data = {}
|
||||||
data['data'] = _serialize(obj)
|
data['data'] = _serialize(obj)
|
||||||
data['action'] = "delete"
|
data['action'] = "delete"
|
||||||
data['type'] = _get_type(obj)
|
data['type'] = _get_type(obj)
|
||||||
|
data['deleted_date'] = deleted_date
|
||||||
|
|
||||||
return _send_request(webhook_id, url, key, data)
|
return _send_request(webhook_id, url, key, data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue