-
Notifications
You must be signed in to change notification settings - Fork 82
When updating a task if it belongs to a GithubRepo update associated issue on github #803
Copy link
Copy link
Closed
Milestone
Description
Problem
In the first iteration of github integration, a project can be assigned a repository on github, via a dropdown. Likewise, a task can then be assigned an issue on github.
If that is the case, when that task updates, the associated issue should update as well.
While we're handling this, we should extract task controller behavior into a separate module.
Subtasks
- If it doesn't already exist, add
/lib/code_corps/task/task.exmodule, namespacedCodeCorps.Task - Add
update/3function to that module- Function accepts task, an attributes map and the current user
- Function updates task, then updates associated github issue if necessary (using information from associated
GithubRepoand thegithub_issue_numberfield. - Function returns
{:ok, task}or{:error, changeset}or{:error, _} - If the current user is GitHub connected, the github API calls should be made on their behalf. If not, they should be made on the behalf of the default user provided by Provide default github user for the purposes of github integration #800
- Modify
TaskController.updateto call the new module function - Add tests for new service module/new function which assert these four cases:
- Task with no github id is updated,
{:ok, updated_task}was returned, no github api call was made - Task with github id was updated,
{:ok, updated_task}was returned, a github call was made - There was a validation error
- There was some other error
- Task with no github id is updated,
The existing controller tests can remain as is.
Reactions are currently unavailable