-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Using local storage for notification toggling #1644
Conversation
@@ -133,7 +150,7 @@ export class AmpUserNotification extends AMP.BaseElement { | |||
* @private | |||
*/ | |||
buildGetHref_(ampUserId) { | |||
return this.urlReplacements_.expand(this.showIfHref_).then(href => { | |||
return this.urlReplacements_.expand(assert(this.showIfHref_)).then(href => { |
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.
is it possible to do the assert earlier than this?
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.
It is done early as well. Just being attentive to types.
@erwinmombay added tests as well. ptal. |
this.dismissHref_ = assertHttpsUrl( | ||
this.element.getAttribute('data-dismiss-href'), this.element); | ||
/** @private @const {?string} */ | ||
this.showIfHref_ = this.element.getAttribute('data-show-if-href'); |
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.
can we either add a note here or on the PR to update validator. (or create an issue)
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 will, as soon as the PR is approved by @erwinmombay and @cramforce
@dvoytenko looks great, LGTM |
Assigning to @cramforce for an additional review. |
'should have "data-dismiss-href" attribute.'); | ||
} | ||
|
||
if (!this.win_.AMP_TEST) { |
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.
Why not in tests? Comment please
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.
Removed. Found another way to do this. But ultimately, I want unit-tests to be untainted by service integration - it's tested separately.
@cramforce changes are complete. PTAL. |
LGTM |
Using local storage for notification toggling
|
||
// Store and post. | ||
if (this.storageKey_) { | ||
this.storagePromise_.then(storage => { |
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.
Shouldn't this be done as a then
callback inside the storageKey_
conditional in #shouldShow
?
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.
Sorry?
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.
My bad, looking at the compressed diff view I thought this was in #shouldShowViaXhr_
. Ignore my comments.
No description provided.