-
Notifications
You must be signed in to change notification settings - Fork 683
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
Renaming some Controller Concerns #1565
Closed
Closed
Changes from 61 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
57fbed5
first set of logs
klenotiw d1d0a05
webhooks manager logs added
klenotiw d4d3946
adding ShopifyApp before all errors
klenotiw df4947b
missed these
klenotiw f71f823
Merge branch 'main' into klenotiw/add-log-levels
klenotiw 45ee7e9
rubocop
klenotiw 3ae6a87
getting this weird error from adding the logs
klenotiw 774dbb5
this was the line that was causing products not to load
klenotiw 1de873b
add more login protection logs
klenotiw 69479ac
change error msg
klenotiw a305805
add two logger functions to the utils module and add log levels to th…
klenotiw f84172c
didn't mean to add this
klenotiw 5e38b94
Merge branch 'main' into klenotiw/add-log-levels
klenotiw f4b8842
add log for andy
klenotiw 69e0f04
Use standard logger
andyw8 d5092db
changing rails logger to utils logger
klenotiw 11049a0
More logging
andyw8 5acf291
Merge branch 'klenotiw/add-log-levels' of https://github.com/Shopify/…
klenotiw 29bd368
levels should layer
klenotiw 283e143
add warn and error
klenotiw bbd0efd
fix comparison
klenotiw 3bd2e3d
default should be info
klenotiw 8b7b67b
change and pull prefix out
klenotiw 36b3ed4
move everything over to new module
klenotiw 5a52b53
messed up syntax
klenotiw 5886ca1
actually fix comparisions
klenotiw 349adf6
rubocop
klenotiw ad3b784
more logs and update old ones
klenotiw 6f704a3
refactor logger
klenotiw ae2bad1
add log and remove pry
klenotiw c4fee42
session repository
klenotiw 84c92fb
change any rails logs to our logger
klenotiw 1a072a9
rubocop
klenotiw cc47406
remove time and format log_level
klenotiw 6222053
rename two controller concern
klenotiw 0d1c795
Merge remote-tracking branch 'origin/klenotiw/add-log-levels' into kl…
klenotiw 7235f2d
add log levels to readme
klenotiw 2ead6bd
add deprecation to logs
klenotiw 09f4e92
Update README.md
klenotiw 02333fe
Update docs/shopify_app/logging.md
klenotiw 5355a16
move logger out of utils and into its own file
klenotiw 8670e87
Merge branch 'klenotiw/add-log-levels' of https://github.com/Shopify/…
klenotiw c5fec08
fix log to be under if
klenotiw 776a11f
Update docs/shopify_app/logging.md
klenotiw 3eb2eb4
Update lib/generators/shopify_app/install/templates/shopify_app.rb.tt
klenotiw 3a2fee7
change namespaces
klenotiw 07a703a
handled errors will be under info
klenotiw 8661bbf
pull out logic from logs and into a variable
klenotiw 55ad138
require logger file
klenotiw 25bbb15
change some logs
klenotiw 25d81cc
Merge branch 'klenotiw/add-log-levels' of https://github.com/Shopify/…
klenotiw 482751e
Merge branch 'main' into klenotiw/add-log-levels
klenotiw dccc327
fix dup message
klenotiw 38d8a74
fix enabled_for_log_level
klenotiw 5fe3abd
add configuration heading
klenotiw 003b38a
add logs to has payment conditionals
klenotiw 68ee4f9
change log
klenotiw ab72180
fix tests and lint
klenotiw 5fcaa00
Merge branch 'klenotiw/add-log-levels' into klenotiw/renaming-control…
klenotiw 268687a
use activesupport for deprecation
klenotiw d273e76
require_know_shop has methods so including/extending doesn't hold all…
klenotiw 728fbb7
fixing include issue
klenotiw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/controllers/concerns/shopify_app/ensure_has_session.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module ShopifyApp | ||
module EnsureHasSession | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
include ShopifyApp::Localization | ||
include ShopifyApp::LoginProtection | ||
include ShopifyApp::CsrfProtection | ||
include ShopifyApp::EmbeddedApp | ||
include ShopifyApp::EnsureBilling | ||
|
||
before_action :login_again_if_different_user_or_shop | ||
around_action :activate_shopify_session | ||
after_action :add_top_level_redirection_headers | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
module ShopifyApp | ||
module EnsureInstalled | ||
extend ActiveSupport::Concern | ||
include ShopifyApp::RedirectForEmbedded | ||
|
||
included do | ||
before_action :check_shop_domain | ||
before_action :check_shop_known | ||
end | ||
|
||
def current_shopify_domain | ||
return if params[:shop].blank? | ||
|
||
@shopify_domain ||= ShopifyApp::Utils.sanitize_shop_domain(params[:shop]) | ||
end | ||
|
||
private | ||
|
||
def check_shop_domain | ||
redirect_to(ShopifyApp.configuration.login_url) unless current_shopify_domain | ||
end | ||
|
||
def check_shop_known | ||
@shop = SessionRepository.retrieve_shop_session_by_shopify_domain(current_shopify_domain) | ||
unless @shop | ||
if embedded_param? | ||
redirect_for_embedded | ||
else | ||
redirect_to(shop_login) | ||
end | ||
end | ||
end | ||
|
||
def shop_login | ||
url = URI(ShopifyApp.configuration.login_url) | ||
|
||
url.query = URI.encode_www_form( | ||
shop: params[:shop], | ||
host: params[:host], | ||
return_to: request.fullpath, | ||
) | ||
|
||
url.to_s | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Logging | ||
|
||
## Log Levels | ||
|
||
1. Debug | ||
2. Info | ||
3. Warn | ||
4. Error | ||
|
||
We have four log levels with `error` being the most severe. | ||
|
||
## Configuration | ||
|
||
You can configure your log level by changing your `SHOPIFY_LOG_LEVEL` environment variable. If `SHOPIFY_LOG_LEVEL` is not set the configuration file with default to `info`. To turn off all shopify_app logs you can change this environment variable to `off`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 would say 'replaced by' rather than
renamed to
here, since if someone is upgrading from an older version then there may also be behavior changes.