Commit 2a0ca652 authored by Stan Hu's avatar Stan Hu

Fix epic subscriptions not working for subgroups

The change in https://gitlab.com/gitlab-org/gitlab/merge_requests/22872
caused the wrong path to be passed to the GraphQL endpoint. The frontend
passed only the immediate path (e.g. `charts`) instead of the full path
(e.g. `gitlab-org/charts`).

Closes https://gitlab.com/gitlab-org/gitlab/issues/197483
parent 6735832c
...@@ -189,7 +189,7 @@ export const toggleEpicSubscription = ({ state, dispatch }) => { ...@@ -189,7 +189,7 @@ export const toggleEpicSubscription = ({ state, dispatch }) => {
variables: { variables: {
epicSetSubscriptionInput: { epicSetSubscriptionInput: {
iid: `${state.epicIid}`, iid: `${state.epicIid}`,
groupPath: state.groupPath, groupPath: state.fullPath,
subscribedState: !state.subscribed, subscribedState: !state.subscribed,
}, },
}, },
......
...@@ -3,6 +3,7 @@ export default () => ({ ...@@ -3,6 +3,7 @@ export default () => ({
endpoint: '', endpoint: '',
updateEndpoint: '', updateEndpoint: '',
fullPath: '',
groupPath: '', groupPath: '',
markdownPreviewPath: '', markdownPreviewPath: '',
labelsPath: '', labelsPath: '',
......
...@@ -777,6 +777,9 @@ describe('Epic Store Actions', () => { ...@@ -777,6 +777,9 @@ describe('Epic Store Actions', () => {
}, },
}; };
const stateSubscribed = { const stateSubscribed = {
epicIid: 123,
groupPath: 'charts',
fullPath: 'gitlab-org/charts',
subscribed: false, subscribed: false,
}; };
...@@ -813,6 +816,19 @@ describe('Epic Store Actions', () => { ...@@ -813,6 +816,19 @@ describe('Epic Store Actions', () => {
], ],
done, done,
); );
const tester = {
asymmetricMatch(actual) {
const variables = actual.variables.epicSetSubscriptionInput;
return (
variables.iid === `${stateSubscribed.epicIid}` &&
variables.groupPath === stateSubscribed.fullPath
);
},
};
expect(epicUtils.gqClient.mutate).toHaveBeenCalledWith(tester);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment