hide-comments.py is hiding the wrong bug
Bug #674759 reported by
Michael Barnett
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Unassigned |
Bug Description
When i attempt to hide https:/
Changed in malone: | |
status: | New → Triaged |
importance: | Undecided → High |
To post a comment you must log in.
Right, if the comment number as shown on bug pages like /bugs.launchpad .net/ubuntu/ +source/ compiz- fusion- plugins- main/+bug/ 183685? comments= all Visibility( comment_ number, visible), the wrong
https:/
is used as the value of the parameter comment_number in
IBug.setComment
comment can be changed. The reason:
def setCommentVisib ility(self, user, comment_number, visible):
bug_message_ set = getUtility( IBugMessageSet) set.getByBugAnd Message( comment_ number] )
bug_message. visible = visible
"""See `IBug`."""
bug_message = bug_message_
self, self.messages[
So, the method changes the bug_message having the index
comment_number in the sequence of all [bug_]messages.
But the comments displayed and indexed on /bugs.launchpad .net/ubuntu/ +source/ compiz- fusion- plugins- main/+bug/ 183685? comments= all comments gets the for_bugtask( ):
https:/
are slightly differently created: BugTaskView.
sequence of comments to display from the function
get_comments_
def get_comments_ for_bugtask( bugtask, truncate=False):
"""Return BugComments related to a bugtask.
This code builds a sorted list of BugComments in one shot, bug.getMessageC hunks() from_chunks( chunks, bugtask, truncate=truncate)
requiring only two database queries. It removes the titles
for those comments which do not have a "new" subject line
"""
chunks = bugtask.
comments = build_comments_
and getMessageChunks() retrieves, as the name suggests, message chunks
related to a given bug:
def getMessageChunk s(self) :
Message. id = MessageChunk. message AND
BugMessage .message = Message.id AND
BugMessage .bug = %s
"""See `IBug`."""
query = """
""" % sqlvalues(self)
chunks = MessageChunk. select( query,
clauseTabl es=["BugMessage ", "Message"],
The problem: There exist messages without any associated chunks, so for_bugtask( ).
these messages do not appear in the result of get_comments_
To check:
SELECT Message. datecreated, Message.id, BugMessage.id
Message. id = BugMessage.message AND (1=1) datecreated, Message.id;
FROM BugMessage, Message
WHERE BugMessage.bug = 183685 AND
ORDER BY Message.
returns all message IDs related to the given bug.
And
select MessageChunk.id, Message.id, BugMessage.id message AND
BugMessage. message = Message.id AND
BugMessage.bug = 183685;
from MessageChunk, Message, BugMessage
where Message.id = MessageChunk.
returns the IDs of all messages having at least one MessageChunnk.
Comparing the results of these queries, it turns out that exactly ility is
five Message IDs from the former query are missing the in the latter
one. And the former query is basically the same query as the one issued
when bug.messages is retrieved, i.e., when setCommentVisib
called.