-
Notifications
You must be signed in to change notification settings - Fork 650
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
Enable FullStory for users on the PERSONAL30 plan #13753
Conversation
app/helpers/application_helper.rb
Outdated
@@ -119,7 +119,7 @@ def insert_hubspot_form(form = 'newsletter') | |||
|
|||
def insert_fullstory | |||
if Cartodb.get_config(:fullstory, 'org').present? && current_user && | |||
current_user.account_type.casecmp('FREE').zero? && params[:cookies] != '0' | |||
['FREE','PERSONAL30'].include?(current_user.account_type.upcase) && params[:cookies] != '0' |
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.
Align the operands of a condition in an if statement spanning multiple lines.
Space missing after comma.
Wait wait wait, we can't do this. |
@alonsogarciapablo take a look at this: https://github.com/CartoDB/cartodb-management/issues/5020 |
Thanks @arianaescobar! I will take a look and make sure this won't put us all in jail! 😂 |
app/helpers/application_helper.rb
Outdated
if fullstory_org.present? && | ||
user_plan_supported && | ||
user_signed_up_after_min_signed_up_date && | ||
params[:cookies] != '0' |
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.
Align the operands of a condition in an if statement spanning multiple lines.
app/helpers/application_helper.rb
Outdated
current_user.created_at > min_signed_up_date | ||
|
||
if fullstory_org.present? && | ||
user_plan_supported && |
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.
Align the operands of a condition in an if statement spanning multiple lines.
app/helpers/application_helper.rb
Outdated
user_plan_supported = current_user && | ||
['FREE', 'PERSONAL30'].include?(current_user.account_type.upcase) | ||
user_signed_up_after_min_signed_up_date = current_user && | ||
current_user.created_at > min_signed_up_date |
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.
Align the operands of an expression in an assignment spanning multiple lines.
app/helpers/application_helper.rb
Outdated
min_signed_up_date = Date.new(2017,01,01) | ||
fullstory_org = Cartodb.get_config(:fullstory, 'org') | ||
user_plan_supported = current_user && | ||
['FREE', 'PERSONAL30'].include?(current_user.account_type.upcase) |
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.
Align the operands of an expression in an assignment spanning multiple lines.
app/helpers/application_helper.rb
Outdated
# which is the date where a message to accept the Terms and | ||
# conditions and the Privacy policy was included in the Signup page. | ||
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f | ||
min_signed_up_date = Date.new(2017,01,01) |
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.
Space missing after comma.
Use 0o for octal literals.
Talked to @agnesgyorfi about this and made some changes to the PR. I updated the PR description and explained there how it works now. |
app/helpers/application_helper.rb
Outdated
|
||
if fullstory_org.present? && | ||
user_plan_supported && | ||
user_signed_up_after_min_signed_up_date && |
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.
Align the operands of a condition in an if statement spanning multiple lines.
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.
Please, apply Hound suggestions. Also, consider:
- We have 120 column lines in Ruby. Use them! ;)
- You could do a
return unless current_user
at the beginning of the method and avoid a couple ofcurrent_user
checks.
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.
Some files could not be reviewed due to errors:
.rubocop.yml: Lint/EndAlignment has the wrong namespace - should be Layout
.rubocop.yml: Lint/EndAlignment has the wrong namespace - should be Layout .rubocop.yml: Lint/DefEndAlignment has the wrong namespace - should be Layout .rubocop.yml: Lint/BlockAlignment has the wrong namespace - should be Layout .rubocop.yml: Lint/ConditionPosition has the wrong namespace - should be Layout Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead. (obsolete configuration found in .rubocop.yml, please update it)
app/helpers/application_helper.rb
Outdated
# which is the date where a message to accept the Terms and | ||
# conditions and the Privacy policy was included in the Signup page. | ||
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f | ||
min_signed_up_date = Date.new(2017, 01, 01) |
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.
Use 0o for octal literals.
Thanks for your feedback @javitonino! I changed the code a bit in a892a81. |
app/helpers/application_helper.rb
Outdated
min_signed_up_date = Date.new(2017, 01, 01) | ||
fullstory_org = Cartodb.get_config(:fullstory, 'org') | ||
user_plan_supported = ['FREE', 'PERSONAL30'].include?(current_user.account_type.upcase) | ||
user_signed_up_after_min_signed_up_date = current_user.created_at > min_signed_up_date |
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.
@javitonino I noticed a similar logic exists here. It looks like in other places we use the fullstoryEnabled
variable to determine if FullStory is enabled. Basically: here and here. I have no idea what those files are being used for, but it seems that we need to DRY this up a bit.
app/models/user.rb
Outdated
# which is the date where a message to accept the Terms and | ||
# conditions and the Privacy policy was included in the Signup page. | ||
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f | ||
FULLSTORY_ENABLED_MIN_DATE = Date.new(2017, 01, 01) |
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.
Use 0o for octal literals.
app/models/carto/user.rb
Outdated
# which is the date where a message to accept the Terms and | ||
# conditions and the Privacy policy was included in the Signup page. | ||
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f | ||
FULLSTORY_ENABLED_MIN_DATE = Date.new(2017, 01, 01) |
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.
Use 0o for octal literals.
@@ -6,6 +6,7 @@ module FrontendConfigHelper | |||
UPGRADE_LINK_ACCOUNT = 'PERSONAL30'.freeze | |||
|
|||
def frontend_config_hash(user = current_user) | |||
byebug |
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.
Remove debugger entry point byebug.
@@ -643,6 +650,10 @@ def locked? | |||
state == STATE_LOCKED | |||
end | |||
|
|||
def fullstory_enabled? |
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 thought about moving this logic to the user too. Love it. 👏👏👏
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.
Perhaps worth extracting this logic to a module (concern?) that both Carto::User
and User
can share? There's the risk of someone changing this logic in only one place otherwise...
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.
No need. This is the standard approach for duplicated Sequel/AR models, we just copy funcionality. We are always aware we need to change it at both places. And it's just another reason to finally deprecate the Sequel model :D
app/helpers/fullstory_helper.rb
Outdated
@@ -0,0 +1,11 @@ | |||
module FullstoryHelper | |||
def fullstory_enabled?(user) |
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 personally think this helper would read better if we inverse the order of these two methods.
@agnesgyorfi FYI: this is how the Dataset view looks like in FS recordings (content of cells are greyed out): |
…/cartodb into fullstory-for-personal30
Deployin' 🚀 |
I was missing some sessions in FullStory. It turns out it was enabled for everyone on the signup flow (commercial site), but only enabled for users on the FREE plan in Dashboard / Builder.
This PR introduces some tweaks to the FullStory setup:
accountType
in Dashboard / Builder / Dataset view.There has been some discussion about this in https://github.com/CartoDB/cartodb-management/issues/5020.
cc: @piensaenpixel @arianaescobar