Commit 7d37748d authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'sh-fix-notification-toggles-epics-subgroups' into 'master'

Fix epic subscriptions not working for subgroups

Closes #197483

See merge request gitlab-org/gitlab!23283
parents 5cd08b0e 4fd56ebf
...@@ -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: '',
......
...@@ -776,11 +776,15 @@ describe('Epic Store Actions', () => { ...@@ -776,11 +776,15 @@ describe('Epic Store Actions', () => {
__typename: 'EpicSetSubscriptionPayload', __typename: 'EpicSetSubscriptionPayload',
}, },
}; };
const stateSubscribed = {
subscribed: false,
};
beforeEach(() => { beforeEach(() => {
Object.assign(state, {
epicIid: 123,
groupPath: 'charts',
fullPath: 'gitlab-org/charts',
subscribed: false,
});
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
}); });
...@@ -799,8 +803,8 @@ describe('Epic Store Actions', () => { ...@@ -799,8 +803,8 @@ describe('Epic Store Actions', () => {
testAction( testAction(
actions.toggleEpicSubscription, actions.toggleEpicSubscription,
{ subscribed: !stateSubscribed.subscribed }, { subscribed: !state.subscribed },
stateSubscribed, state,
[], [],
[ [
{ {
...@@ -808,10 +812,24 @@ describe('Epic Store Actions', () => { ...@@ -808,10 +812,24 @@ describe('Epic Store Actions', () => {
}, },
{ {
type: 'requestEpicSubscriptionToggleSuccess', type: 'requestEpicSubscriptionToggleSuccess',
payload: { subscribed: !stateSubscribed.subscribed }, payload: { subscribed: !state.subscribed },
}, },
], ],
done, () => {
expect(epicUtils.gqClient.mutate).toHaveBeenCalledWith(
jasmine.objectContaining({
variables: jasmine.objectContaining({
epicSetSubscriptionInput: {
iid: `${state.epicIid}`,
groupPath: state.fullPath,
subscribedState: !state.subscribed,
},
}),
}),
);
done();
},
); );
}); });
}); });
...@@ -832,8 +850,8 @@ describe('Epic Store Actions', () => { ...@@ -832,8 +850,8 @@ describe('Epic Store Actions', () => {
testAction( testAction(
actions.toggleEpicSubscription, actions.toggleEpicSubscription,
{ subscribed: !stateSubscribed.subscribed }, { subscribed: !state.subscribed },
stateSubscribed, state,
[], [],
[ [
{ {
......
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