Skip to content
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

Only open prompt when user clicks badge #828

Merged
merged 6 commits into from
Mar 14, 2022
Merged

Only open prompt when user clicks badge #828

merged 6 commits into from
Mar 14, 2022

Conversation

maxxcrawford
Copy link
Collaborator

This PR solves a few different items:

  • Check for isTrusted for any click events
  • Check Login Button detection
  • Bumps all outdated dependencies (via npm audit)

Copy link
Collaborator Author

@maxxcrawford maxxcrawford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review

@@ -268,6 +270,14 @@ function shouldBadgeBeSmall(ratioCheck, itemHeight) {
return false;
}

function openLoginPrompt(parent, el, htmlBadgeDiv) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was required with the isTrusted checks. I moved this function outside of the addEventListener in-line event so that other functions could call it.

@@ -652,7 +692,7 @@ async function detectFacebookOnPage () {

// Check if user dismissed the Relay prompt
const relayAddonPromptDismissed = await getLocalStorageSettingFromBackground("hideRelayEmailBadges");
if (!relayAddonEnabled && !relayAddonPromptDismissed.hideRelayEmailBadges && trackersDetectedOnCurrentPage) {
if (relayAddonPromptDismissed && !relayAddonEnabled && !relayAddonPromptDismissed.hideRelayEmailBadges && trackersDetectedOnCurrentPage) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept getting console errors using this.

To check, visit airbnb.com. You should see an email prompt (if you do not have Relay installed and have not opt'ed out of the labels)

src/content_script.js Outdated Show resolved Hide resolved
Move prevent.default

Co-authored-by: luke crouch <luke.crouch@gmail.com>
@groovecoder groovecoder merged commit 67112e0 into master Mar 14, 2022
@groovecoder groovecoder deleted the is-trusted branch March 14, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants