Skip to content

Commit d6d2f25

Browse files
Update donation blocked naming consistency and add docs. (#797)
1 parent 325eebd commit d6d2f25

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

assets/js/common/donation-notice.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ document.addEventListener('DOMContentLoaded', () => {
6161
const donationButtons = document.querySelectorAll('[data-donate-btn]');
6262
for (const donationButton of donationButtons) {
6363
// Any donation button that redirects should be skipped as that's not where the modal will show up.
64-
if ('dontShowDonationNotice' in donationButton.dataset) {
64+
// Ref: [data-dont-show-donation-blocked-notice]
65+
if ('dontShowDonationBlockedNotice' in donationButton.dataset) {
6566
continue;
6667
}
6768
donationButton.addEventListener('click', () => {

docs/donation-blocked-notice.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Donation Blocked Notice
2+
3+
Controlled by: `settings.SHOW_DONATION_BLOCKED_NOTICE`.
4+
5+
This feature checks to see if the user is on the Donate page, or if they've clicked on a donate button (determined by
6+
`[data-donate-btn]` attribute except for inclusion of `[data-dont-show-donation-blocked-notice]`.) If this check fails a
7+
medium-sized banner will appear the bottom of the screen notifying the user that they have an extension or browser that
8+
is blocking Fundraise Up.
9+
10+
This check is done in `assets/js/common/donation-notice.js`, and simply sees if the user is on the Donate page and for
11+
the existence of the embed donation form widget, or more commonly if they've clicked on a donation button and we don't
12+
receive a Fundraise Up `checkoutOpen` event within 7.5 seconds.
13+
14+
Important to note that if someone's internet is so slow that the checkout modal doesn't load and send that
15+
`checkoutOpen` event within the 7.5 seconds the notice will still show up. However, it will auto-close once we receive
16+
that event.

sites/updates.thunderbird.net/includes/macros/donate-button.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% macro donate_button(form_id=settings.FRU_FORM_IDS['support'], content='cta', source='thunderbird-client', campaign='appeal', base_url=None, disable_notice=False) %}
2-
<a href="{{ donate_url(content=content, campaign=campaign, source=source, form_id=form_id, base_url=base_url) }}" class="donate-banner" {% if base_url != None %}target="_blank"{% endif %} data-donate-btn {% if disable_notice %}data-dont-show-donation-notice{% endif %}>
1+
{% macro donate_button(form_id=settings.FRU_FORM_IDS['support'], content='cta', source='thunderbird-client', campaign='appeal', base_url=None, disable_donation_blocked_notice=False) %}
2+
<a href="{{ donate_url(content=content, campaign=campaign, source=source, form_id=form_id, base_url=base_url) }}" class="donate-banner" {% if base_url != None %}target="_blank"{% endif %} data-donate-btn {% if disable_donation_blocked_notice %}data-dont-show-donation-blocked-notice{% endif %}>
33
<div id="donate-banner-left">
44
{{ _('Click here to <b>Donate!</b>') }}
55
</div>

sites/updates.thunderbird.net/thunderbird/128.0/apr25/donate/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{% set utm_campaign = 'apr25_appeal' %}
1313
{% set donation_base_url = None %}
1414
{# We want to show the redirect notice here as this is where the modal will actually open up. #}
15-
{% set disable_donation_notice_banner = False %}
15+
{% set disable_donation_blocked_notice = False %}
1616

1717

1818
{# Just include previous page instead of duplicating it all #}

sites/updates.thunderbird.net/thunderbird/128.0/apr25/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{% set utm_source = utm_source|default('thunderbird-client') %}
1717
{% set donation_base_url = donation_base_url|default(url('updates.128.appeal.apr25.donate')) %}
1818
{# Disable the donation banner on this redirect page, we set this to false in the actual donation page. #}
19-
{% set disable_donation_notice_banner = disable_donation_notice_banner|default(True) %}
19+
{% set disable_donation_blocked_notice = disable_donation_blocked_notice|default(True) %}
2020

2121
{% extends "includes/base/base.html" %}
2222
{% from 'includes/macros/donate-button.html' import donate_button with context %}
@@ -42,7 +42,7 @@ <h1 id="appeal-heading" aria-label="{{ _('Only 3% of users support Thunderbird.'
4242
{% endblock %}
4343
{% block content %}
4444
<section id="donate-button-container">
45-
{{ donate_button(form_id=fru_form_id, campaign=utm_campaign, source=utm_source, base_url=donation_base_url, disable_notice=disable_donation_notice_banner) }}
45+
{{ donate_button(form_id=fru_form_id, campaign=utm_campaign, source=utm_source, base_url=donation_base_url, disable_donation_blocked_notice=disable_donation_blocked_notice) }}
4646
</section>
4747
<section id="appeal-body">
4848
<div class="letter-container font-xl">

0 commit comments

Comments
 (0)