Task List Disabled on Closed Merge Requests

Summary

The task list checkboxes in the merge request description stay disabled after the merge request is closed/merged.

Steps to reproduce

  1. Create a merge request with a task list
  2. Close the merge request
  3. View the merge request with a different user (that has permission to edit the description)

What is the current bug behavior?

The task list in the merge request's description is never enabled, which prevents toggling tasks checkboxes.

What is the expected correct behavior?

The task list should be enabled, because the user can still edit the description manually. The user that authored the merge request does not experience this issue.

Relevant logs and/or screenshots

https://gitlab.com/deckar01/gitlab-ce-permissions-test/merge_requests/4

Author:

Screen_Shot_2020-01-10_at_8.47.17_AM

Developer:

Screen_Shot_2020-01-10_at_8.47.38_AM

Output of checks

This bug happens on GitLab.com

Possible fixes

https://gitlab.com/gitlab-org/gitlab/blob/9b554fe4/app/assets/javascripts/merge_request.js#L27

This line of code is checking for the presence of a.btn-close (the close button) to infer that the user has permissions to modify the merge request. This line of code has been around for over 3 years, so it is not what caused the bug, but it is very brittle logic that was bound to break eventually.

The underlying cause appears to be the close button being omitted when rendering the template instead of hiding it with CSS as it was before (and still is for the author). Although I can't pinpoint the commit that introduced this change, it seems reasonable. The permissions should be checked directly instead of being inferred by the presence of a button.

Edited by Jared Deckard