Skip to content

Draft: Add CurrentUserTodos widget

Nicolas Dular requested to merge nd/todo-widget into master

What does this MR do and why?

Related issue: #393784 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Feature.enable(:multiple_todos) if you want to test with multiple todos for a work item
  2. Create an OKR, or any other work item (like Tasks) and get the global Work Item ID
  3. Use the following GraphQL queries and mutations to test the feature:
query pendingTodos {
  workItem(id: "gid://gitlab/WorkItem/740") {
    id
    workItemType {
      id
      name
    }
    widgets {
      ... on WorkItemWidgetCurrentUserTodos {
        currentUserTodos(state:pending) {
          edges {
            node {
              id
              state
            }
          }
        }
      }
    }
  }
}

query doneTodos {
  workItem(id: "gid://gitlab/WorkItem/740") {
    id
    workItemType {
      id
      name
    }
    widgets {
      ... on WorkItemWidgetCurrentUserTodos {
        currentUserTodos(state:done) {
          edges {
            node {
              id
              state
            }
          }
        }
      }
    }
  }
}

mutation markAllTodosAsDone {
  workItemUpdate(input:{
    id:"gid://gitlab/WorkItem/740",
    currentUserTodosWidget:{
      action:MARK_AS_DONE
    }

  }) {
    clientMutationId
  }
}

mutation markTodoAsDone {
  workItemUpdate(input:{
    id:"gid://gitlab/WorkItem/740",
    currentUserTodosWidget:{
      todo_id: "gid://gitlab/Todo/40",
      action:MARK_AS_DONE
    }

  }) {
    clientMutationId
  }
}

mutation addNewTodo {
  workItemUpdate(input:{
    id:"gid://gitlab/WorkItem/740",
    currentUserTodosWidget:{
      action:ADD
    }

  }) {
    clientMutationId
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nicolas Dular

Merge request reports