Require authentication for the new work item page

/-/work_items/new answered 200 for signed-out users on public projects and rendered a stub create form that the createWorkItem mutation rejects.

Projects::IssuesController guards :new with authenticate_user!, and Groups::WorkItemsController does the equivalent in handle_new_work_item_path, but Projects::WorkItemsController never gained it. Clicking New item while signed out never opened the modal — create_work_item_modal returns before preventDefault for anonymous users, so the click followed the link. The link and that passthrough both survived the issues to work items migration; only the destination's auth filter was lost.

This restores it, so signed-out users are sent through sign-in and back to the create form with type and initialCreationContext preserved, matching /-/issues/new.

The 'issue building actions' shared example already asserted this redirect but passed for an unrelated reason: its project is private, so anonymous users were redirected by project authorization rather than by the filter. The added example uses a public project, which returned 200 before this change.

Recording

References

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vedant Jain

Merge request reports

Loading
Loading