-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidation of notification creation #8824
Conversation
da741c1
to
3c0ad81
Compare
2782354
to
b08896c
Compare
3efebbc
to
a210f12
Compare
a210f12
to
10ef9e8
Compare
python: can't open file '/home/runner/work/django-DefectDojo/django-DefectDojo/.github/scripts/git_protect.py': [Errno 2] No such file or directory |
31156ef
to
931cee7
Compare
The following files are protected and cannot be modified: |
931cee7
to
877a5a7
Compare
The following files are protected and cannot be modified: |
The following files are protected and cannot be modified: |
73cdc7f
to
f77d4ab
Compare
The following files are protected and cannot be modified: |
f77d4ab
to
d732f5e
Compare
The following files are protected and cannot be modified: |
The following files are protected and cannot be modified: |
334ae53
to
3e2ddc0
Compare
The following files are protected and cannot be modified: |
The following files are protected and cannot be modified: |
556c299
to
3ec4cb3
Compare
e5f5171
to
a5e8119
Compare
Signed-off-by: kiblik <[email protected]>
Signed-off-by: kiblik <[email protected]>
2b4a518
to
8524d92
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the issues I found last time have been fixed! Thanks for digging into this. I think I found the source of the issue with endpoint deletions not triggering alerts: bulk delete (see video). I'm not sure whether that deserves its own PR or if it would be in scope for this one, I'll leave that up to you.
description = _('The endpoint "%(name)s" was deleted by %(user)s') % { | ||
'name': str(instance), 'user': le.actor} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked this again and it looks like the actor is being populated successfully now when the alert is created (API and UI)!
However, I think I may have found the source of the missing notifications that I mentioned last time - using bulk delete on the Endpoints page does not trigger an alert.
Screen.Recording.2024-05-16.at.11.42.58.mov
|
||
logger = logging.getLogger(__name__) | ||
@receiver(post_delete, sender=Test) | ||
def test_post_delete(sender, instance, using, origin, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remains true - no Test deletion alerts when deleting from either the UI or API
dojo/product/signals.py
Outdated
if settings.ENABLE_AUDITLOG: | ||
le = LogEntry.objects.get( | ||
action=LogEntry.Action.DELETE, | ||
content_type=ContentType.objects.get(app_label='dojo', model='product'), | ||
object_id=instance.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback and for testing again.
If everybody agrees, I hope this PR is ready for merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thorough explanation! I agree that it would be better to address the work required for those additional fixes in one or more follow-on PRs 👍
Purpose of this PR: If some action triggers the creation of a notification during clicking in UI. The same notification should be triggered also if the same happens via API. Until now many actions have been avoiding these notifications. Implementation is done by Django Signals.
Some notes:
event="other"
. Now notification engine accepts any event name as meaningful and for Alerts event is translated to source name. If event type does not exist as the field in Notification, the engine works with the event as withother