Merge ~pappacena/launchpad:fix-distroseries-diff-comment into launchpad:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: e3a5def3f5474d83810e93c03581add97a8592d8
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/launchpad:fix-distroseries-diff-comment
Merge into: launchpad:master
Diff against target: 48 lines (+6/-2)
1 file modified
lib/lp/registry/browser/distroseriesdifference.py (+6/-2)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+403202@code.launchpad.net

Commit message

Fixing a bug on DistroSeries diff page

Description of the change

DistroSeriesDifferenceDisplayComment object should follow the same pattern used by BugComment, for example: implement IDistroSeriesDifferenceDisplayComment, but delegating anything related to IMessage to comment.message.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/registry/browser/distroseriesdifference.py b/lib/lp/registry/browser/distroseriesdifference.py
2index d58ce5f..60f7b87 100644
3--- a/lib/lp/registry/browser/distroseriesdifference.py
4+++ b/lib/lp/registry/browser/distroseriesdifference.py
5@@ -1,4 +1,4 @@
6-# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
7+# Copyright 2010-2021 Canonical Ltd. This software is licensed under the
8 # GNU Affero General Public License version 3 (see the file LICENSE).
9
10 """Browser views for DistroSeriesDifferences."""
11@@ -9,6 +9,7 @@ __all__ = [
12 'DistroSeriesDifferenceView',
13 ]
14
15+from lazr.delegates import delegate_to
16 from lazr.restful.interfaces import IWebServiceClientRequest
17 from zope.browserpage import ViewPageTemplateFile
18 from zope.component import (
19@@ -46,6 +47,7 @@ from lp.services.comments.interfaces.conversation import (
20 IComment,
21 IConversation,
22 )
23+from lp.services.messages.interfaces.message import IMessage
24 from lp.services.propertycache import cachedproperty
25 from lp.services.webapp import (
26 LaunchpadView,
27@@ -240,11 +242,12 @@ class DistroSeriesDifferenceView(LaunchpadFormView):
28 self.show_package_diffs_request_link)
29
30
31-class IDistroSeriesDifferenceDisplayComment(IComment):
32+class IDistroSeriesDifferenceDisplayComment(IComment, IMessage):
33 """Marker interface."""
34
35
36 @implementer(IDistroSeriesDifferenceDisplayComment)
37+@delegate_to(IMessage, context='_message')
38 class DistroSeriesDifferenceDisplayComment(MessageComment):
39 """Used simply to provide `IComment` for rendering."""
40
41@@ -258,6 +261,7 @@ class DistroSeriesDifferenceDisplayComment(MessageComment):
42 """Setup the attributes required by `IComment`."""
43 super(DistroSeriesDifferenceDisplayComment, self).__init__(None)
44 self.comment = comment
45+ self._message = comment.message
46
47
48 def get_message(comment):