Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab
GitLab
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 34,898
    • Issues 34,898
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 1,217
    • Merge Requests 1,217
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #211864

Closed
Open
Opened Mar 19, 2020 by Joe Harman@toejough0 of 2 tasks completed0/2 tasks

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
Backlog
Milestone
Backlog
Assign milestone
Time tracking
None
Due date
None
Reference: gitlab-org/gitlab#211864