setCommentVisibility doesn't work as expected in an unordered comment list case

Bug #2034027 reported by Ines Almeida
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Medium
Unassigned

Bug Description

In the specific case where bug IDs don't match the order that they were added (see https://bugs.launchpad.net/ubuntu/+source/gcc-13/+bug/2030797 as an example, where comment #1 comes after comment #7 - this bug seems to have been imported from an external source), then when we run the endpoint `setCommentVisibility(<comment_number>)` then I would expect that comment #<comment_number> to be hidden, but instead the <comment_number>-th comment is hidden.

In the example bug above, if we run `setCommentVisibility(1)`, we will hide comment #3 instead of comment #1.

Tags: comments
Revision history for this message
Ines Almeida (ines-almeida) wrote :

Verified in staging that indeed when calling `setCommentVisibility(1)` (both via API and using the UI) in the example bug above, comment #3 is the one being updated.

I drafted a quick test to verify that the issue happens when the date when the comments were created don't match their index order. When we fetch the comment to set its visibility, we get the list of comments ordered by date, and then simply get the n-th comment.

This bug should only happen in very rare cases.

tags: added: comments
Changed in launchpad:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.