Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,763
    • Issues 44,763
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,330
    • Merge requests 1,330
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #211864
Closed
Open
Issue created Mar 19, 2020 by Joe Harman@toejough0 of 2 checklist items completed0/2 checklist items

Public API for Group Level Reordering Issues

Problem to solve

Our REST API currently supports re-ordering issues within a project. This makes all the group users that want to re-order issues across many projects via public APIs very sad.

Proposal

Provide a public API for re-ordering issues globally across all subgroups and projects.

Context

Relevant code here is in https://gitlab.com/gitlab-org/gitlab/blob/e0d317ca8d7ba39e92fc7f89387055be087e0bae/app/services/issues/update_service.rb#L157:

issue =
  if board_group_id
    IssuesFinder.new(current_user, group_id: board_group_id, include_subgroups: true).find_by(id: id)
  else
    project.issues.find(id)
  end

We actually already accept global issue IDs in the API (not iids). The problem is that when we query, we scope it to the project if a group_id is not provided.

When ordering issues in an issue board, we pass in a group_id to the update service. We could do the same if we create a group-level reorder issues API endpoint.

Implementation Approach

Change project issue reordering API so that it accepts issues from another group.

We already accept an issue ID (not IID) for move_before_id and move_after_id in this API so the only thing that would change would be how we find the issue and our validations. We just need to validate that the before / after issues are part of the same scope for ordering.

Note that there's a tricky bug here similar to #13254 (closed). We use Issue#parent_ids for determining ordering scope and right now we scope it to the project's parent group when a group board is present. But this is not taking into account that there may be ancestor group boards that may also contain this issue.

So I'm not sure if we should limit this to parent group issues, or allow all group hierarchy issues and maybe just fix this other bug too.

Acceptance

  • Public API for global issue re-order across all subgroups and projects within a given top level group.
  • Expose relative_position attribute in the issue JSON API responses (#21297 (comment 372766565))
Edited Oct 16, 2020 by Gabe Weaver
Assignee
Assign to
Time tracking