Merge lp:~abentley/launchpad/bugcomment-interface into lp:launchpad
Status: | Merged |
---|---|
Merged at revision: | 14683 |
Proposed branch: | lp:~abentley/launchpad/bugcomment-interface |
Merge into: | lp:launchpad |
Diff against target: |
531 lines (+123/-95) 9 files modified
lib/lp/bugs/browser/bugcomment.py (+58/-42) lib/lp/bugs/browser/bugtask.py (+6/-9) lib/lp/bugs/browser/tests/bugtarget-filebug-views.txt (+15/-8) lib/lp/bugs/browser/tests/test_bugcomment.py (+19/-1) lib/lp/bugs/scripts/tests/test_bugimport.py (+4/-5) lib/lp/bugs/tests/bugs-emailinterface.txt (+4/-2) lib/lp/services/messages/interfaces/message.py (+1/-8) lib/lp/services/messages/model/message.py (+12/-17) lib/lp/testing/factory.py (+4/-3) |
To merge this branch: | bzr merge lp:~abentley/launchpad/bugcomment-interface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Deryck Hodge (community) | Approve | ||
Review via email: mp+87808@code.launchpad.net |
Commit message
Make BugComment implement IBugComment
Description of the change
= Summary =
Make BugComment provide IBugComment
== Proposed fix ==
Delegate IMessage (a base class of IBugComment) to BugComment._message
== Pre-implementation notes ==
Discussed with deryck, discussed eager-loading approach with lifeless
== Implementation details ==
BugComment claimed to implement IMessage, but verifyObject showed it did not. The 'followup_title' and 'has_new_title' IMessage properties turned out to be unused, so I deleted them. Ultimately, I decided to modernize our code by delegating to Message.
This means BugComment no longer directly provides title, datecreated, owner, rfc822msgid, chunks and visible. It provides bugattachments because, unlike IMessage, BugComments do not consider patches to be BugAttachments.
This caused database queries to increase, because BugComment had been acting as an eager-loaded of MessageChunks and BugAttachments. To restore this eager loading, I converted Message.
I also adapted the comment hiding and truncation functionality so that the parameters are supplied in the constructor, and applied in text_for_display.
== Tests ==
bin/test -v test_bugcomment
== Demo and Q/A ==
None
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
This looks fantastic, Aaron. This is a nice refactor, thanks!