forked from mozilla/pontoon
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement email unsubscribe page (mozilla#3237)
This patch adds a unique user identifier to existing and new users, and uses it to create personalized unsubscribe links.
- Loading branch information
Showing
11 changed files
with
195 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.2.11 on 2024-05-22 12:25 | ||
|
||
from django.db import migrations, models | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("base", "0062_userprofile_email_consent_dismissed_at"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="userprofile", | ||
name="unique_id", | ||
field=models.UUIDField(default=uuid.uuid4, editable=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.11 on 2024-05-22 12:25 | ||
|
||
import uuid | ||
|
||
from django.db import migrations | ||
|
||
|
||
def populate_unique_id(apps, schema_editor): | ||
UserProfile = apps.get_model("base", "UserProfile") | ||
for profile in UserProfile.objects.all(): | ||
profile.unique_id = uuid.uuid4() | ||
profile.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("base", "0063_userprofile_unique_id"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
code=populate_unique_id, | ||
reverse_code=migrations.RunPython.noop, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
body > header { | ||
background: transparent; | ||
border-color: transparent; | ||
position: fixed; | ||
width: 100%; | ||
z-index: 10; | ||
} | ||
|
||
body > header.menu-opened { | ||
border-color: var(--main-border-1); | ||
} | ||
|
||
#main { | ||
padding: 0; | ||
} | ||
|
||
#main section { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100vh; | ||
|
||
background-image: var(--homepage-background-image); | ||
background-attachment: fixed; | ||
background-size: cover; | ||
} | ||
|
||
#main section .container { | ||
display: flex; | ||
flex: 1; | ||
flex-direction: column; | ||
align-items: start; | ||
justify-content: center; | ||
overflow: hidden; | ||
} | ||
|
||
#main h1 { | ||
font-size: 64px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
#main p { | ||
font-size: 22px; | ||
font-weight: 300; | ||
line-height: 36px; | ||
width: 900px; | ||
} | ||
|
||
#main p a { | ||
color: var(--status-translated); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block title %}Subscribe{% endblock %} | ||
|
||
{% block class %}unsubscribe{% endblock %} | ||
|
||
{% block middle %} | ||
<section id="main"> | ||
<section> | ||
<div class="container"> | ||
<h1>You've been subscribed</h1> | ||
<p class="main-text">Subscribed by accident? <a href="{{ url('pontoon.messaging.unsubscribe', uuid) }}">Unsubscribe again</a> or update your email <a href="{{ url('pontoon.contributors.settings') }}">settings</a>.</p> | ||
</div> | ||
</section> | ||
</section> | ||
{% endblock %} | ||
|
||
{% block extend_css %} | ||
{% stylesheet 'unsubscribe' %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block title %}Unsubscribe{% endblock %} | ||
|
||
{% block class %}unsubscribe{% endblock %} | ||
|
||
{% block middle %} | ||
<section id="main"> | ||
<section> | ||
<div class="container"> | ||
<h1>You've been unsubscribed</h1> | ||
<p class="main-text">Unsubscribed by accident? <a href="{{ url('pontoon.messaging.subscribe', uuid) }}">Subscribe again</a> or update your email <a href="{{ url('pontoon.contributors.settings') }}">settings</a>.</p> | ||
</div> | ||
</section> | ||
</section> | ||
{% endblock %} | ||
|
||
{% block extend_css %} | ||
{% stylesheet 'unsubscribe' %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters