Skip to content

Fix duplicated issues while sorting by weight

What does this MR do?

It appies a fix that removes duplicates while sorting issues by weight. (This bug is present on gitlab.com)

Steps to reproduce:

  1. Open a list of issues and choose sorting by weight

https://gitlab.com/gitlab-org/gitlab-ce/issues?sort=weight

  1. Open a new tab with a next page of the issues with the same sorting

https://gitlab.com/gitlab-org/gitlab-ce/issues?page=2&sort=weight&state=opened

  1. Compare issues between these two pages and most probably you will spot a duplicate.

Problem

When the sorting by weight is applied then it is possible that the same issue will appear again, when a user goes the next page.

It happens because issues might have the same weight and database does not guarantee the same order ,unless we explicitly request it.

I found a MR that makes a similar fix for CE version. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4878

However, EE version overrides this fix and we need to apply it again.

Let me know if something is missing or requires a change. Thanks!

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports