-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add add-on data attr if subdomain is set #1036
Conversation
privaterelay/templates/profile.html
Outdated
{% if settings.PREMIUM_ENABLED %} | ||
{% with request.user.profile_set.first as user_profile %} | ||
{% if user_profile.subdomain %} | ||
data-premium-subdomain-set="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.
Rather than just setting true
, can I get an output from the variable? Similar to var foo = (x > y)
in JS?
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.
Yup, the user_profile.subdomain
value should be a string of the user's subdomain. So it could be:
data-premium-subdomain-set="true" | |
data-premium-subdomain-set="{{ user_profile.subdomain }}" |
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.
Would setting it to a string of the user's subdomain be necessary to check if a user has one?
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.
@codemist So…if one isn't set is appears as:
data-premium-subdomain-set="None"
So, in your add-on logic, you'll need to catch this. if subdomain === "None"
, etc.
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.
Ahhhh I see!
privaterelay/templates/profile.html
Outdated
{% if settings.PREMIUM_ENABLED %} | ||
{% with request.user.profile_set.first as user_profile %} | ||
{% if user_profile.subdomain %} | ||
data-premium-subdomain-set="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.
Yup, the user_profile.subdomain
value should be a string of the user's subdomain. So it could be:
data-premium-subdomain-set="true" | |
data-premium-subdomain-set="{{ user_profile.subdomain }}" |
Expected:
If you're a user who is premium AND logged in AND have registered a subdomain, then the data-attr
data-premium-subdomain-set
will be set to whatever the subdomain is in thefirefox-private-relay-addon-data
custom element.Otherwise, that data-attr will have the value of
None
in thefirefox-private-relay-addon-data
element.