Commit e550811c authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'fix-design-todo-design-id' into 'master'

Include designId in todo creation payload

See merge request gitlab-org/gitlab!42058
parents a36b15b2 957610b5
...@@ -5,7 +5,7 @@ import createDesignTodoMutation from '../graphql/mutations/create_design_todo.mu ...@@ -5,7 +5,7 @@ import createDesignTodoMutation from '../graphql/mutations/create_design_todo.mu
import TodoButton from '~/vue_shared/components/todo_button.vue'; import TodoButton from '~/vue_shared/components/todo_button.vue';
import allVersionsMixin from '../mixins/all_versions'; import allVersionsMixin from '../mixins/all_versions';
import { updateStoreAfterDeleteDesignTodo } from '../utils/cache_update'; import { updateStoreAfterDeleteDesignTodo } from '../utils/cache_update';
import { findIssueId } from '../utils/design_management_utils'; import { findIssueId, findDesignId } from '../utils/design_management_utils';
import { CREATE_DESIGN_TODO_ERROR, DELETE_DESIGN_TODO_ERROR } from '../utils/error_messages'; import { CREATE_DESIGN_TODO_ERROR, DELETE_DESIGN_TODO_ERROR } from '../utils/error_messages';
export default { export default {
...@@ -45,6 +45,7 @@ export default { ...@@ -45,6 +45,7 @@ export default {
return { return {
projectPath: this.projectPath, projectPath: this.projectPath,
issueId: findIssueId(this.design.issue.id), issueId: findIssueId(this.design.issue.id),
designId: findDesignId(this.design.id),
issueIid: this.issueIid, issueIid: this.issueIid,
filenames: [this.$route.params.id], filenames: [this.$route.params.id],
atVersion: this.designsVersion, atVersion: this.designsVersion,
......
...@@ -30,11 +30,15 @@ const resolvers = { ...@@ -30,11 +30,15 @@ const resolvers = {
cache.writeQuery({ query: activeDiscussionQuery, data }); cache.writeQuery({ query: activeDiscussionQuery, data });
}, },
createDesignTodo: (_, { projectPath, issueId, issueIid, filenames, atVersion }, { cache }) => { createDesignTodo: (
_,
{ projectPath, issueId, designId, issueIid, filenames, atVersion },
{ cache },
) => {
return axios return axios
.post(`/${projectPath}/todos`, { .post(`/${projectPath}/todos`, {
issue_id: issueId, issue_id: issueId,
issuable_id: issueIid, issuable_id: designId,
issuable_type: 'design', issuable_type: 'design',
}) })
.then(({ data }) => { .then(({ data }) => {
......
mutation createDesignTodo( mutation createDesignTodo(
$projectPath: String! $projectPath: String!
$issueId: String! $issueId: String!
$designId: String!
$issueIid: String! $issueIid: String!
$filenames: [String]! $filenames: [String]!
$atVersion: String $atVersion: String
...@@ -8,6 +9,7 @@ mutation createDesignTodo( ...@@ -8,6 +9,7 @@ mutation createDesignTodo(
createDesignTodo( createDesignTodo(
projectPath: $projectPath projectPath: $projectPath
issueId: $issueId issueId: $issueId
designId: $designId
issueIid: $issueIid issueIid: $issueIid
filenames: $filenames filenames: $filenames
atVersion: $atVersion atVersion: $atVersion
......
...@@ -32,6 +32,8 @@ export const findNoteId = id => (id.match('DiffNote/(.+$)') || [])[1]; ...@@ -32,6 +32,8 @@ export const findNoteId = id => (id.match('DiffNote/(.+$)') || [])[1];
export const findIssueId = id => (id.match('Issue/(.+$)') || [])[1]; export const findIssueId = id => (id.match('Issue/(.+$)') || [])[1];
export const findDesignId = id => (id.match('Design/(.+$)') || [])[1];
export const extractDesigns = data => data.project.issue.designCollection.designs.nodes; export const extractDesigns = data => data.project.issue.designCollection.designs.nodes;
export const extractDesign = data => (extractDesigns(data) || [])[0]; export const extractDesign = data => (extractDesigns(data) || [])[0];
......
...@@ -112,6 +112,7 @@ describe('Design management design todo button', () => { ...@@ -112,6 +112,7 @@ describe('Design management design todo button', () => {
variables: { variables: {
atVersion: null, atVersion: null,
filenames: ['my-design.jpg'], filenames: ['my-design.jpg'],
designId: '1',
issueId: '1', issueId: '1',
issueIid: '10', issueIid: '10',
projectPath: 'project-path', projectPath: 'project-path',
......
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