Skip to content

Added comment syncing with github during create and update#925

Merged
joshsmith merged 13 commits intonp-github-create-taskfrom
801-802-propagate-comment-changes-to-github-comments
Sep 19, 2017
Merged

Added comment syncing with github during create and update#925
joshsmith merged 13 commits intonp-github-create-taskfrom
801-802-propagate-comment-changes-to-github-comments

Conversation

@begedin
Copy link
Copy Markdown
Contributor

@begedin begedin commented Sep 11, 2017

Closes #801, #802

This PR implements github syncing of comments during the :update and :create actions.

It uses #805 as a template, so the implementation is similar.

#805 should be merged and this rebased before it's reviewed, since this PR builds on top of that one. The base of this PR should be changed to develop once #805 is merged.

@begedin begedin requested a review from joshsmith September 11, 2017 14:08
@begedin begedin changed the base branch from develop to np-github-create-task September 11, 2017 14:08
@begedin begedin force-pushed the np-github-create-task branch 2 times, most recently from 0cf146d to 0261a04 Compare September 12, 2017 13:48
@begedin begedin force-pushed the 801-802-propagate-comment-changes-to-github-comments branch 2 times, most recently from d17f2a7 to 20cd868 Compare September 13, 2017 12:33
@joshsmith
Copy link
Copy Markdown
Contributor

joshsmith commented Sep 14, 2017

Are these merge conflicts due to needing a rebase or what? I know I need to review #805 first.

@begedin
Copy link
Copy Markdown
Contributor Author

begedin commented Sep 14, 2017

@joshsmith I'm not seeing any merge conflicts here. Did you fix them? EIther way, no point in reviewing this until we agree #805 is good to merge, since any changes to the process there will likely have to be applied to the process here as well.

@begedin begedin force-pushed the np-github-create-task branch from d138594 to 8e9e980 Compare September 14, 2017 06:42
@begedin begedin force-pushed the 801-802-propagate-comment-changes-to-github-comments branch from 20cd868 to 137f580 Compare September 14, 2017 06:50
@begedin begedin force-pushed the np-github-create-task branch 2 times, most recently from 0b0ec6d to f494d39 Compare September 14, 2017 15:00
@begedin begedin force-pushed the 801-802-propagate-comment-changes-to-github-comments branch from 137f580 to c4ab799 Compare September 14, 2017 15:08
@joshsmith joshsmith force-pushed the np-github-create-task branch from f494d39 to d13b138 Compare September 14, 2017 22:09
@joshsmith
Copy link
Copy Markdown
Contributor

There are conflicts again.

@begedin
Copy link
Copy Markdown
Contributor Author

begedin commented Sep 15, 2017

And there will be as long as #805 keeps getting modified. My vote is to leave this alone until that one is done. I've spent close to a day rebasing and resolving here, when it can't be merged anyway until we deal with #805

@begedin begedin force-pushed the np-github-create-task branch from 8db93a3 to ce0c874 Compare September 15, 2017 09:22
@joshsmith joshsmith self-assigned this Sep 16, 2017
@joshsmith joshsmith force-pushed the 801-802-propagate-comment-changes-to-github-comments branch 2 times, most recently from 1dc7a6b to cd33f9d Compare September 16, 2017 17:58
Copy link
Copy Markdown
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the comment is created from Code Corps but done by the code-corps-local[bot] account, then when the webhook comes back the comment gets overwritten with that (bot) user, overwriting entirely the original user on Code Corps who created it.

There's some work to do here to resolve this.

@joshsmith
Copy link
Copy Markdown
Contributor

Also, while I don't have time right this moment to write a failing test, posting a comment gets a 403 error because plug CodeCorpsWeb.Plug.IdsToIntegers is not being used in the CommentController (and wasn't clear to me that it needed to be used). This suggests something is wrong with our testing, or even just the way we're processing IDs generally.

@joshsmith
Copy link
Copy Markdown
Contributor

Unrelated – but it's only started happening here – when I run mix phx.server I now get tests running automatically every time the code changes, as though I were running mix test.watch or something. I see that mix_test_watch is set to run only in :dev, which may be part of the problem. But it makes it impossible to do debugging because the tests are just clouding the log output.

@joshsmith joshsmith added this to the GitHub integration milestone Sep 16, 2017
@begedin
Copy link
Copy Markdown
Contributor Author

begedin commented Sep 18, 2017

@joshsmith Regarding id's to integers, I should have written about this, but simply put, I forgot, so it's a mistake on my part. Sorry.

I encountered this about two weeks back. The phoenix API does not convert numbers in received request bodies into integers. However, elixir does not auto-cast strings to integers in any way, so comparison in those cases is troublesome.

The problem with that is that ember's json api adapter, casts all ids to strings, because, while our ids are all integers, some apis might have uuids, slugs, etc, for ids, so that's the safest approach from ember's POV.

Even for us Repo.get(User, 1) and Repo.get(User, "1") is interchangeable. It's just this specific case of comparing a record id against a param value, where the param value will always be string by default is when it fails.

That's why I concluded that the better place to handle the conversion is in the API, even though it may make sense to do it in our ember app's serializers to.

As you can see, the issue has been identified and resolved in the task pr, but I didn't get a chance to propagate it to this comment PR yet.

All that being said, even though there are arguments for implementing the fix for the issue this way, through the plug, I'm still not completely sure this is the best approach, so I'm open for discussion and suggestions.

begedin and others added 4 commits September 18, 2017 16:42
Fix dependencies sort in mix.exs
Switch OrganizationGithubAppInstallationController away from ja_resource and canary

Closes #893
Switch OrganizationGithubAppInstallation away from ja_resource and canary
@begedin begedin force-pushed the 801-802-propagate-comment-changes-to-github-comments branch from 238a5a6 to 4aca24b Compare September 18, 2017 15:18
joshsmith and others added 3 commits September 18, 2017 12:31
Removed test_watch as a dependency
… sends

This reveals a bug in the comment controller, which is now fixed.
…se-string-ids-as-ember

Rewrote api helpers to use string ids, which is what our ember client sends
npendery and others added 3 commits September 18, 2017 17:48
…refactors

- if task params containg a "github_repo_id", an issue is created on github alongside task and task is associated with issue
- refactors:
  - removed reliance on ja_resource and canary from task controller
  - extracted task creation into separate module
  - extracted task-related queries into separate module
  - removed some unused code
  - moved some code around to follow boundex context convention
  - fixed several dialyzer warnings
@joshsmith joshsmith force-pushed the 801-802-propagate-comment-changes-to-github-comments branch from 4aca24b to 98238be Compare September 19, 2017 00:48
@joshsmith joshsmith merged commit bb8c9c8 into np-github-create-task Sep 19, 2017
@joshsmith joshsmith deleted the 801-802-propagate-comment-changes-to-github-comments branch September 19, 2017 01:11
@joshsmith
Copy link
Copy Markdown
Contributor

@begedin I decided to merge this now so we can circle back to the user issues as a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants