Add latest changes from gitlab-org/gitlab@18-1-stable-ee

This commit is contained in:
GitLab Bot
2025-07-16 10:11:18 +00:00
parent fcfe8f05d3
commit 9224ecd30f
5 changed files with 34 additions and 22 deletions

View File

@ -11,7 +11,7 @@ import { isPositiveInteger } from '~/lib/utils/number_utils';
import { scrollUp } from '~/lib/utils/scroll_utils';
import { getParameterByName, mergeUrlParams } from '~/lib/utils/url_utility';
import { TYPENAME_USER } from '~/graphql_shared/constants';
import { convertToGraphQLId, getIdFromGraphQLId } from '~/graphql_shared/utils';
import { convertToGraphQLId } from '~/graphql_shared/utils';
import IssuableList from '~/vue_shared/issuable/list/components/issuable_list_root.vue';
import IssuableMilestone from '~/vue_shared/issuable/list/components/issuable_milestone.vue';
import { DEFAULT_PAGE_SIZE, mergeRequestListTabs } from '~/vue_shared/issuable/list/constants';
@ -145,12 +145,11 @@ export default {
getMergeRequestsCountsQuery: { default: undefined },
getMergeRequestsApprovalsQuery: { default: undefined },
isProject: { default: true },
groupId: { default: undefined },
namespaceId: { default: undefined },
showNewResourceDropdown: { default: undefined },
},
data() {
return {
namespaceId: null,
branchCacheAges: {},
filterTokens: [],
mergeRequests: [],
@ -182,7 +181,6 @@ export default {
if (!data) {
return;
}
this.namespaceId = getIdFromGraphQLId(data.namespace.id);
this.pageInfo = data.namespace.mergeRequests?.pageInfo ?? {};
},
error(error) {
@ -837,7 +835,7 @@ export default {
<new-resource-dropdown
v-if="showNewResourceDropdown"
resource-type="merge-request"
:group-id="groupId"
:group-id="namespaceId"
:query-variables="resourceDropdownQueryVariables"
with-local-storage
/>

View File

@ -23,7 +23,7 @@ export async function mountMergeRequestListsApp({
const {
autocompleteAwardEmojisPath,
fullPath,
groupId,
namespaceId,
hasAnyMergeRequests,
hasScopedLabelsFeature,
initialSort,
@ -87,7 +87,7 @@ export async function mountMergeRequestListsApp({
getMergeRequestsCountsQuery,
getMergeRequestsApprovalsQuery,
isProject,
groupId: groupId ? `${groupId}` : null,
namespaceId: namespaceId ? `${namespaceId}` : null,
showNewResourceDropdown: parseBoolean(showNewResourceDropdown),
},
render: (createComponent) => createComponent(MergeRequestsListApp),

View File

@ -262,6 +262,7 @@ module MergeRequestsHelper
merge_project = merge_request_source_project_for_project(project)
common_merge_request_list_data(current_user).merge({
namespace_id: project.id,
full_path: project.full_path,
has_any_merge_requests: project_merge_requests(project).exists?.to_s,
new_merge_request_path: merge_project && project_new_merge_request_path(merge_project),
@ -277,7 +278,7 @@ module MergeRequestsHelper
def group_merge_requests_list_data(group, current_user)
common_merge_request_list_data(current_user).merge({
group_id: group.id,
namespace_id: group.id,
full_path: group.full_path,
show_new_resource_dropdown: (current_user.presence && any_projects?(@projects)).to_s,
has_any_merge_requests: group_merge_requests(group).exists?.to_s,

View File

@ -172,8 +172,8 @@ describe('Merge requests list app', () => {
const projectId = 1;
const fullPath = 'gitlab-org/gitlab';
const allBranchesPath = `/api/${apiVersion}/projects/${encodeURIComponent(fullPath)}/repository/branches`;
const sourceBranchPath = `/-/autocomplete/merge_request_source_branches.json?project_id=${projectId}`;
const targetBranchPath = `/-/autocomplete/merge_request_target_branches.json?project_id=${projectId}`;
const sourceBranchPath = '/-/autocomplete/merge_request_source_branches.json';
const targetBranchPath = '/-/autocomplete/merge_request_target_branches.json';
let axiosMock;
beforeEach(() => {
@ -185,10 +185,7 @@ describe('Merge requests list app', () => {
describe('with no projectId', () => {
it('uses the generic "all branches" endpoint', async () => {
const queryResponse = getQueryResponse;
queryResponse.data.namespace.id = null;
createComponent({ response: queryResponse });
createComponent({ provide: { namespaceId: null } });
await waitForPromises();
await wrapper.vm.fetchBranches();
@ -199,17 +196,33 @@ describe('Merge requests list app', () => {
describe('with projectId', () => {
it.each`
branchPath | fetchArgs
${targetBranchPath} | ${['target']}
${sourceBranchPath} | ${['source']}
${allBranchesPath} | ${['']}
branchPath | fetchArgs
${`${targetBranchPath}?project_id=${projectId}`} | ${['target']}
${`${sourceBranchPath}?project_id=${projectId}`} | ${['source']}
${allBranchesPath} | ${['']}
`(
'selects the correct path ($branchPath) given the arguments $fetchArgs',
async ({ branchPath, fetchArgs }) => {
const queryResponse = getQueryResponse;
queryResponse.data.namespace.id = projectId;
createComponent({ provide: { namespaceId: projectId } });
await waitForPromises();
createComponent({ response: queryResponse });
await wrapper.vm.fetchBranches(...fetchArgs);
expect(axiosMock.history.get[0].url).toBe(branchPath);
},
);
});
describe('when in a group', () => {
it.each`
branchPath | fetchArgs
${`${targetBranchPath}?group_id=${projectId}`} | ${['target']}
${`${sourceBranchPath}?group_id=${projectId}`} | ${['source']}
${allBranchesPath} | ${['']}
`(
'selects the correct path ($branchPath) given the arguments $fetchArgs',
async ({ branchPath, fetchArgs }) => {
createComponent({ provide: { isProject: false, namespaceId: projectId } });
await waitForPromises();
await wrapper.vm.fetchBranches(...fetchArgs);

View File

@ -395,7 +395,7 @@ RSpec.describe MergeRequestsHelper, feature_category: :code_review_workflow do
it 'returns the correct data' do
expected_data = {
group_id: group.id,
namespace_id: group.id,
full_path: group.full_path,
show_new_resource_dropdown: "false",
autocomplete_award_emojis_path: autocomplete_award_emojis_path,