Skip to content

When editing comment on cc, if comment has a github_id, update associated github comment #802

@begedin

Description

@begedin

Problem

A CodeCorps project might be connected to one or more github repositories

In such a project, all Tasks should also be connected to a GitHub issue belonging to one of those repositories, so the comments need to be connected to their respective comments as well.

When such a comment is updated, the same update should propagate to the related Github comment as well.

If the author is not connected, the system should provide a user to update as. This is provided by #800.

We should also extract the comment update behavior into a module, since it's getting more complex now.

Subtasks

  • If the module does not yet exist, add /lib/codecorps/task/comment.ex, namespaced CodeCorps.Task.Comment
  • Add update/3 function to module, which accepts a comment struct, an attributes map and a current user
    • updates comment
    • the comment should have a github_id. It's task parent should be related to a GithubRepo. This information should be used to update the associated github issue
    • this should be done on behalf of the comment user, or, if the comment user is not connected with github, on behalf of the identity provided in Provide default github user for the purposes of github integration #800
  • Modify Comment controller update action to call this new module
  • Write tests for new module update function to ensure the github sync part works. The controller action itself is already tested well enough.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions