-
Notifications
You must be signed in to change notification settings - Fork 569
Database Migration and Model Update for Organization Webhook #668
Conversation
@@ -22,6 +22,10 @@ class Organization < ActiveRecord::Base | |||
|
|||
validates :slug, uniqueness: true | |||
|
|||
validates :webhook_id, uniqueness: true, allow_nil: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this optional since this feature will be placed under Flipper.
I think this pull request is ready for review. Would you mind take a look at it when you're available? Thanks 😄 |
@@ -98,6 +98,24 @@ def team_invitations_url | |||
"https://github.com/orgs/#{login}/invitations/new" | |||
end | |||
|
|||
# Public | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ✂️ the comments out for now, they more of place holders for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✂️ in d5902e2
@cyhsutw I'll give this a proper 👀 tomorrow. |
def create_organization_webhook(config: {}, options: {}) | ||
GitHub::Errors.with_error_handling do | ||
hook_config = github_org_hook_default_config.merge(config) | ||
.tap { |hash| hash[:secret] = ENV['WEBHOOK_SECRET'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add this to the Rails secrets.yml file so that we don't pull from the ENV
@cyhsutw this is looking ✨. |
@tarebyte Thanks for the feedback and suggestions. Changes have been made according to your comments. I would really appreciate it if you could have a 👀 at them when you're available. |
def create_organization_webhook(webhook_url) | ||
webhook = github_organization.create_organization_webhook(config: { url: webhook_url }) | ||
update_attributes(webhook_id: webhook.id) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this is method is called. Is will this be used in another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will be used in the next PR.
@cyhsutw I posted one last question, and then I think this'll be good to ship! |
Migration was successful. |
Thanks a lot @tarebyte! |
Hello guys,
This pull request is a part of #667.
Summary of changes:
Organization
create
anddelete
webhook on GitHubWould love to hear your feedback on this 😄