-
Notifications
You must be signed in to change notification settings - Fork 8
add slack notification integration #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ def create | |
|
|
||
| if draft.save | ||
| redirect_to draft, notice: 'Your new shelter is pending approval.' | ||
| send_slack_notification "New shelter added: https://irma-api.herokuapp.com/drafts/#{draft.id}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think some Slack formatting would add a nice touch here. Maybe include send_slack_notification "New shelter added in <https://irma-api.herokuapp.com/drafts/#{draft.id}|#{draft.record.shelter}>"You could also make it a call to action, ie "Admins, please review new shelter in https://irma-api.herokuapp.com/drafts/#{draft.id}|#{draft.record.shelter}" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you use |
||
| else | ||
| @shelter = Shelter.new(shelter_update_params) | ||
| render :new | ||
|
|
@@ -51,6 +52,7 @@ def update | |
|
|
||
| if draft.save | ||
| redirect_to draft, notice: 'Your shelter update is pending approval.' | ||
| send_slack_notification "Shelter updated: https://irma-api.herokuapp.com/drafts/#{draft.id}" | ||
| else | ||
| render :edit | ||
| end | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,9 +19,13 @@ | |
|
|
||
| development: | ||
| secret_key_base: d22cd95910c4425ab8adfd2aa968b845775c6ffff23f9cdb337bc6f210199ca97736ed261d06bf69242f6483a8e6c474ab88f02dabb9865f9911ff215da31695 | ||
|
|
||
| slack_token: "xoxp-235986621104-238493557106-238649524195-b886dacfa83620d7c79b483114198cf9" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a real token? It might be better as an environment variable like SECRET_KEY_BASE below. That would make sense for all the environments. Someone with Heroku access to the app would need to set this up before deploying. The secret should be rolled as well. |
||
| slack_channel: "#shelters_notif" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be good as a environment variable too, even if it isn't a secret per se. That'd make it easy to test in development. |
||
|
|
||
| test: | ||
| secret_key_base: 44caab1bd8c8d8cf74981bfc824b9c0a1786d7bc3a2d6b09f493f69b3fdd0c76b19d1e587545be50f8f4ae3fd66506b8b113a00a98ae7f8e7b00bf4b21690aeb | ||
| slack_token: "xoxp-235986621104-238493557106-238649524195-b886dacfa83620d7c79b483114198cf9" | ||
| slack_channel: "#shelters_notif" | ||
|
|
||
| # Do not keep production secrets in the unencrypted secrets file. | ||
| # Instead, either read values from the environment. | ||
|
|
@@ -30,3 +34,5 @@ test: | |
|
|
||
| production: | ||
| secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> | ||
| slack_token: "xoxp-235986621104-238493557106-238649524195-b886dacfa83620d7c79b483114198cf9" | ||
| slack_channel: "#shelters_notif" | ||
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.
There's a slack ruby client you can consider using, instead of making the calls directly.