Remove deprecated Api.users and Api.user

What does this MR do and why?

Removes Api.users and Api.user from app/assets/javascripts/api.js.

Both methods carried a @deprecated tag that pointed to getUsers and getUser in ~/rest_api.

One caller remained. The roadmap filtered search mixin passed Api.users.bind(Api) as the author token's fetchUsers. It now passes getUsers, which takes the same (query, options) arguments and resolves to the same axios response, so the token reads res.data as before.

How the search for callers was done:

  • A dependency-cruiser walk lists 109 modules that import ~/api directly, plus the ones that reach it through ee/api, which spreads the CE object.
  • A search of the whole app, ee/app, spec and ee/spec trees for Api.users and Api.user as calls, as .bind references, and as bracket access finds nothing else.
  • Every spec that transitively depends on api.js was run with jest --findRelatedTests. See the verification section.

The two path constants usersPath and userPath were used only by these methods, so they go too. The two examples in spec/frontend/api_spec.js that exercised the methods are removed with them.

Api.groups and Api.projects carry the same tag but still have nine callers. They are out of scope here.

How to set up and validate locally

yarn jest spec/frontend/api_spec.js ee/spec/frontend/roadmap/components/roadmap_filters_spec.js
rg -n '\bApi\.(users|user)\b' app ee/app spec ee/spec

The specs pass and the search returns nothing.

The first pipeline on this MR failed in roadmap_filters_spec.js, because the mixin reference above was missed. After the fix, every spec that transitively depends on api.js or the mixin was run locally:

yarn jest --findRelatedTests app/assets/javascripts/api.js ee/app/assets/javascripts/roadmap/mixins/filtered_search_mixin.js

1912 of 1917 suites pass. The five that fail also fail on an unrelated master checkout with the same local fixtures, so they are environmental: commit_pipelines_list_spec.js, pipelines_app_spec.js, groups_view_spec.js, projects_view_spec.js and approval_rules_wrapper_spec.js.

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.

References

  • Found while profiling ESLint in #630872 (closed). The import-x/no-deprecated rule cannot see members of a default-exported object, so these tags were never enforced.
  • Prompted by the eslint-plugin-import-x switch in !257578 (merged)

🤖 Generated with Claude Code

Edited by Miguel Rincon

Merge request reports

Loading
Loading