chore: added identifiers in the notification (#5513)
This commit is contained in:
parent
dbecf5cf5e
commit
a3a7053be7
3 changed files with 144 additions and 6 deletions
|
|
@ -1,13 +1,11 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
# Third Party imports
|
# Third Party imports
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
|
|
||||||
# Django imports
|
# Django imports
|
||||||
from django.conf import settings
|
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,9 @@ def extract_mentions(issue_instance):
|
||||||
"mention-component", attrs={"target": "users"}
|
"mention-component", attrs={"target": "users"}
|
||||||
)
|
)
|
||||||
|
|
||||||
mentions = [mention_tag["entity_identifier"] for mention_tag in mention_tags]
|
mentions = [
|
||||||
|
mention_tag["entity_identifier"] for mention_tag in mention_tags
|
||||||
|
]
|
||||||
|
|
||||||
return list(set(mentions))
|
return list(set(mentions))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -198,6 +200,16 @@ def create_mention_notification(
|
||||||
"actor": str(activity.get("actor_id")),
|
"actor": str(activity.get("actor_id")),
|
||||||
"new_value": str(activity.get("new_value")),
|
"new_value": str(activity.get("new_value")),
|
||||||
"old_value": str(activity.get("old_value")),
|
"old_value": str(activity.get("old_value")),
|
||||||
|
"old_identifier": (
|
||||||
|
str(activity.get("old_identifier"))
|
||||||
|
if activity.get("old_identifier")
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(activity.get("new_identifier"))
|
||||||
|
if activity.get("new_identifier")
|
||||||
|
else None
|
||||||
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -440,6 +452,24 @@ def notifications(
|
||||||
if issue_comment is not None
|
if issue_comment is not None
|
||||||
else ""
|
else ""
|
||||||
),
|
),
|
||||||
|
"old_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get("old_identifier")
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get("new_identifier")
|
||||||
|
else None
|
||||||
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -489,6 +519,28 @@ def notifications(
|
||||||
if issue_comment is not None
|
if issue_comment is not None
|
||||||
else ""
|
else ""
|
||||||
),
|
),
|
||||||
|
"old_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
"activity_time": issue_activity.get(
|
"activity_time": issue_activity.get(
|
||||||
"created_at"
|
"created_at"
|
||||||
),
|
),
|
||||||
|
|
@ -572,6 +624,28 @@ def notifications(
|
||||||
"old_value": str(
|
"old_value": str(
|
||||||
issue_activity.get("old_value")
|
issue_activity.get("old_value")
|
||||||
),
|
),
|
||||||
|
"old_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
"activity_time": issue_activity.get(
|
"activity_time": issue_activity.get(
|
||||||
"created_at"
|
"created_at"
|
||||||
),
|
),
|
||||||
|
|
@ -627,6 +701,28 @@ def notifications(
|
||||||
"old_value": str(
|
"old_value": str(
|
||||||
last_activity.old_value
|
last_activity.old_value
|
||||||
),
|
),
|
||||||
|
"old_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -662,7 +758,31 @@ def notifications(
|
||||||
"old_value": str(
|
"old_value": str(
|
||||||
last_activity.old_value
|
last_activity.old_value
|
||||||
),
|
),
|
||||||
"activity_time": str(last_activity.created_at),
|
"old_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"activity_time": str(
|
||||||
|
last_activity.created_at
|
||||||
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -719,6 +839,28 @@ def notifications(
|
||||||
"old_value"
|
"old_value"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
"old_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"old_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"new_identifier": (
|
||||||
|
str(
|
||||||
|
issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if issue_activity.get(
|
||||||
|
"new_identifier"
|
||||||
|
)
|
||||||
|
else None
|
||||||
|
),
|
||||||
"activity_time": issue_activity.get(
|
"activity_time": issue_activity.get(
|
||||||
"created_at"
|
"created_at"
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
# Python imports
|
# Python imports
|
||||||
import os
|
import os
|
||||||
import ssl
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import certifi
|
|
||||||
|
|
||||||
# Third party imports
|
# Third party imports
|
||||||
import dj_database_url
|
import dj_database_url
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue