Add a signal for when the issue status of a comment gets updated.
Review Request #14297 — Created Jan. 17, 2025 and updated
This change adds a signal for when the issues status of a comment gets
updated. This signal is needed for the WIP Bitbucket Server Pull Request
integration (and future pull request integrations), which will listen to
the signal so that it can update the review request approval status
displayed on the pull request whenever an issue is dropped/fixed/re-opened.
It's also just generally useful to have.While here, I also fixed up two bugs that I noticed with our comments:
We override the save method for the
BaseComment
class, but failed to pass
any**kwargs
todjango.db.models.Model.save()
, so full model updates
were happening every time, even ifupdate_fields
was passed. I added a
unit test that had I used to check this.We use an attribute called
_loaded_issue_status
to track the previous
issue status on a comment, and compare it to the new issue status on updates.
Previously, we only set this attribute on comment initialization. So if one
instance of a comment went from open, to dropped, to re-opened, the issue
state wouldn't actually update from dropped to re-opened. Our issues status
updating logic would compare the re-opened state to the initial open state
that was set during initialization, even though the real previous issue
state at the time was dropped. This was never an issue in production
because when toggling issue statuses from the UI, a new comment object
instance would be created upon each toggle. This is now fixed by
setting the_loaded_issue_status
whenever the issue status changes.I also fixed some typos in some signal doc comments.
- Ran unit tests.
- Tested creating comments with and without issues, then toggling between open/fixed/dropped/re-opened states.
Summary | ID |
---|---|
47fe51e933b5287531dadad5cd429823fdbee04e |
Description | From | Last Updated | ||
---|---|---|---|---|
'django.contrib.auth.models.User' imported but unused Column: 5 Error code: F401 |
![]() |
|||
There are no open issues |