Skip to content

Gold makes projects ad-free again #6073

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

Merged
merged 6 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/advertising/ethical-advertising.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ We have added multiple ways to opt out of the advertising on Read the Docs.
1. You can go completely ad-free
by becoming a `Gold Member <https://readthedocs.org/accounts/gold/>`_
or a `Supporter <https://readthedocs.org/sustainability/#donations>`_.
Additionally, Gold Members may remove advertising from their projects for all visitors.

2. You can opt out of seeing paid advertisements on documentation pages:

Expand All @@ -182,5 +183,4 @@ We have added multiple ways to opt out of the advertising on Read the Docs.
but our commercial plans don't seem like the right fit,
please `get in touch`_ to discuss alternatives to advertising.

.. _paid plans: https://readthedocs.com/pricing/
.. _get in touch: mailto:[email protected]?subject=Alternatives%20to%20advertising
5 changes: 3 additions & 2 deletions docs/advertising/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ that respects user privacy.

We recognize that advertising is not for everyone.
You may :ref:`opt out of paid advertising <advertising/ethical-advertising:Opting Out>`
-- you will still see :ref:`community ads <advertising/ethical-advertising:Community Ads>` --
or you can go ad-free by `becoming a Gold Member`_ or a `Supporter`_ of Read the Docs.
although you will still see :ref:`community ads <advertising/ethical-advertising:Community Ads>`.
You can go ad-free by `becoming a Gold Member`_ or a `Supporter`_ of Read the Docs.
Copy link
Member

Choose a reason for hiding this comment

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

I think this PR should also make a publicly accessible landing page for Gold. We really need a way to link to it for people that are logged out, and it seems like the most obvious missing piece currently to making it more "understandable".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My plan was to repurpose https://readthedocs.org/sustainability/ and go into Gold in more details there.

Gold Members can also remove advertising from their projects for all visitors.

For businesses looking to remove advertising,
please consider :doc:`Read the Docs for Business </commercial/index>`.
Expand Down
7 changes: 5 additions & 2 deletions media/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,12 @@ div.donate-stats h2 {
margin: .5em 0em 1.5em 0em;
}

#content ul.donate-about {
margin-bottom: 1em;
}
ul.donate-about li {
margin-left: 1em;
list-style: inside;
margin-left: 1.5em;
list-style: initial;
}

div.donate-stats-sm form {
Expand Down
11 changes: 0 additions & 11 deletions readthedocs/gold/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""Django models for recurring donations aka Gold Membership."""
import math
from datetime import datetime
Expand Down Expand Up @@ -29,9 +27,6 @@ class GoldUser(models.Model):

"""A user subscription for gold membership."""

# Gold members created after this date can no longer sponsor projects to be ad-free
SPONSOR_PROJECT_CUTOFF = pytz.utc.localize(datetime(year=2019, month=5, day=1))

pub_date = models.DateTimeField(_('Publication date'), auto_now_add=True)
modified_date = models.DateTimeField(_('Modified date'), auto_now=True)

Expand Down Expand Up @@ -66,9 +61,3 @@ def num_supported_projects(self):
dollars = int(self.level.split('-')[-1])
num_projects = int(math.floor(dollars // DOLLARS_PER_PROJECT))
return num_projects

def can_sponsor_projects(self):
if self.pub_date < self.SPONSOR_PROJECT_CUTOFF or self.projects.exists():
return True

return False
65 changes: 32 additions & 33 deletions readthedocs/gold/templates/gold/projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,52 @@

{% block profile-admin-gold-edit %}active{% endblock %}

{% block title %}
Gold Projects
{% endblock %}
{% block title %}{% trans "Gold Projects" %}{% endblock %}


{% block edit_content %}

<p class="empty">
<h3>{% trans "Gold Projects" %}</h3>
<p>
{% blocktrans trimmed %}
<strong>Note:</strong> this is a legacy feature.
New gold members cannot sponsor projects to be ad-free.
Gold Members may completely remove advertising for all visitors to their projects.
{% endblocktrans %}
</p>

<p class="help_text">
{% trans "Choose projects that will have all promos removed, and extra features added to them. You get to pick one for every $5/mo you support Read the Docs with." %}
</p>

<h3> {% trans "Existing Projects" %} </h3>
<p>
{% blocktrans trimmed count projects=gold_user.num_supported_projects %}
You can adopt one project with your subscription.
{% plural %}
You can adopt {{ projects }} projects with your subscription.
{% endblocktrans %}
</p>
<ul class="donate-about">
<li>{% trans 'For small businesses or personal projects, we ask for $5 per month to remove ads from a project.' %}</li>
<li>{% trans 'For corporate supported open source projects, we ask for a $50 membership in order to cover our support and operations costs.' %}</li>
</ul>

<ul>
{% for project in projects %}
<h3>{% trans 'Adopted projects' %}</h3>
<ul class="donate-about">
{% for project in projects %}
<li>
<a href="{{ project.get_absolute_url }}">
{{ project }}
</a>
(<a href="{% url "gold_projects_remove" project.slug %}">{% trans "Remove" %}</a>)
<a href="{{ project.get_absolute_url }}">{{ project }}</a>
<span>(<a href="{% url "gold_projects_remove" project.slug %}">{% trans "Remove Ad-Free Status" %}</a>)</span>
</li>
{% endfor %}
{% empty %}
<p>{% trans 'You have not adopted any projects.' %}</p>
{% endfor %}
</ul>

<h3>{% trans "Add a project" %}</h3>
<p>
{% trans "Choose which project you would like to add." %}
</p>
<form method="post" action=".">{% csrf_token %}
{{ form.as_p }}
<h3>{% trans "Adopt a project" %}</h3>
{% if gold_user.num_supported_projects > projects|length %}
<p>
{% trans "Choose which project you would like to make ad-free." %}
</p>
<form method="post" action=".">{% csrf_token %}
{{ form.as_p }}
<p>
<input type="submit" value="{% trans "Make Project Ad-Free" %}">
</p>
</form>
{% else %}
<p>
<input style="display: inline;" type="submit" value="{% trans "Submit" %}">
{% blocktrans trimmed with gold_level=gold_user.get_level_display %}
You have already adopted all the projects you can with your current Gold Membership of {{ gold_level }}.
{% endblocktrans %}
</p>
</form>
{% endif %}

{% endblock %}
18 changes: 5 additions & 13 deletions readthedocs/gold/templates/gold/subscription_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,11 @@ <h2>{% trans "Gold Subscription" %}</h2>
<button>{% trans "Cancel Subscription" %}</button>
</form>

{% if golduser.can_sponsor_projects %}
<h3>{% trans "Projects" %}</h3>
<p class="subscription-projects">
{% blocktrans trimmed count projects=golduser.num_supported_projects %}
You can adopt one project with your subscription.
{% plural %}
You can adopt {{ projects }} projects with your subscription.
{% endblocktrans %}
</p>
<h3>{% trans "Gold projects" %}</h3>
<p class="subscription-projects">{% trans 'Choose projects you would like to make ad-free.' %}</p>

<form method="get" action="{% url "gold_projects" %}" class="subscription-projects">
<button>{% trans "Select Projects" %}</button>
</form>
{% endif %}
<form method="get" action="{% url "gold_projects" %}" class="subscription-projects">
<button>{% trans "Select Projects" %}</button>
</form>
</div>
{% endblock %}
39 changes: 11 additions & 28 deletions readthedocs/gold/templates/gold/subscription_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,52 +43,35 @@ <h2>Read the Docs Gold</h2>
product.
{% endblocktrans %}
</p>

<p>
{% blocktrans trimmed %}
If you are an individual,
feel free to give whatever feels right for the value you get out of Read the Docs.
Becoming a Gold Member makes Read the Docs ad-free for as long as you are logged-in.
Gold Members may also completely remove advertising for all visitors to their projects.
{% endblocktrans %}
</p>

<ul class="donate-about">
<li>{% trans 'For small businesses or personal projects, we ask for $5 per month to remove ads from a project.' %}</li>
<li>{% trans 'For corporate supported open source projects, we ask for a $50 membership in order to cover our support and operations costs.' %}</li>
</ul>

<p>
{% blocktrans trimmed %}
If you are a company using Read the Docs,
please consider <a href="https://readthedocs.com/">Read the Docs for Business</a>.
This will help us cover our costs,
and provide you with a better experience on the site.
If you aren't able to do that,
we suggest giving at least $20/month to help cover our support and operations costs.
{% endblocktrans %}
</p>

<p>{% trans 'Becoming a Gold Member also makes Read the Docs ad-free for as long as you are logged-in.' %}</p>

<p>
{% blocktrans trimmed %}
You can also make one-time donations on our <a href="https://readthedocs.org/sustainability/">sustainability</a> page.
{% endblocktrans %}
</p>

{% if domains.count %}
<h3>Domains</h3>
<p>
{% blocktrans trimmed %}
We ask that folks who use custom Domains give Read the Docs $5 per domain they are using.
This is optional, but it really does help us maintain the site going forward.
For any questions about our Gold Membership program,
please <a href="mailto:[email protected]?subject=Gold%20membership%20questions">email us</a>.
{% endblocktrans %}
</p>

<p>
You are currently using {{ domains.count }} domains:

<ul class="donate-about">
{% for domain in domains %}
<li>{{ domain.domain }} ({{ domain.project.name }})</li>
{% endfor %}
</ul>
</p>

{% endif %}

{% trans "Become a Gold Member" as subscription_title %}
{% if golduser %}
{% trans "Update Your Subscription" as subscription_title %}
Expand Down
4 changes: 0 additions & 4 deletions readthedocs/gold/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ def projects(request):
gold_user = get_object_or_404(GoldUser, user=request.user)
gold_projects = gold_user.projects.all()

if not gold_user.can_sponsor_projects():
messages.error(request, _('New gold users are no longer allowed to sponsor projects'))
return HttpResponseRedirect(reverse('gold_detail'))

if request.method == 'POST':
form = GoldProjectForm(
active_user=request.user,
Expand Down
20 changes: 0 additions & 20 deletions readthedocs/rtd_tests/tests/test_gold.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from datetime import timedelta

from django.test import TestCase
from django.urls import reverse
from django_dynamic_fixture import fixture, get
Expand All @@ -21,7 +18,6 @@ def setUp(self):
GoldUser,
user=self.user,
level=LEVEL_CHOICES[0][0],
pub_date=GoldUser.SPONSOR_PROJECT_CUTOFF - timedelta(days=1),
)

self.client.login(username='owner', password='test')
Expand All @@ -32,22 +28,6 @@ def test_adding_projects(self):
self.assertEqual(self.golduser.projects.count(), 1)
self.assertEqual(resp.status_code, 302)

def test_adding_projects_after_cutoff(self):
user = create_user(username='testuser', password='testtest')
self.client.login(username='testuser', password='testtest')
after_cutoff_golduser = get(
GoldUser,
user=user,
level=LEVEL_CHOICES[0][0],
pub_date=GoldUser.SPONSOR_PROJECT_CUTOFF + timedelta(days=1),
)
self.assertEqual(after_cutoff_golduser.projects.count(), 0)

# Ensure no gold project is created
resp = self.client.post(reverse('gold_projects'), data={'project': 'test'})
self.assertEqual(after_cutoff_golduser.projects.count(), 0)
self.assertEqual(resp.status_code, 302)

def test_too_many_projects(self):
self.project2 = get(Project, slug='test2')

Expand Down
13 changes: 11 additions & 2 deletions readthedocs/templates/projects/project_advertising.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ <h4>{% trans "Opting out" %}</h4>
{% endblocktrans %}
</li>

<li class="module-item">
{% url "gold_detail" as gold_detail %}
{% blocktrans trimmed %}
By becoming a <a href="{{ gold_detail }}">Gold Member</a> to Read the Docs,
you may remove advertising from your projects for all visitors.
{% endblocktrans %}
</li>

<li class="module-item">
{% blocktrans trimmed %}
Project owners can <a href="#removing-paid-advertising">opt out of paid advertisements</a>
Expand All @@ -87,7 +95,7 @@ <h4>{% trans "Opting out" %}</h4>
<li class="module-item">
{% blocktrans trimmed %}
If you would like to completely remove advertising from your open source project,
but Read the Docs for Business doesn't seem like the right fit,
but both Read the Docs for Business and our Gold Memberships don't seem like the right fit,
please <a href="mailto:[email protected]?subject=Alternatives%20to%20advertising">get in touch</a>
to discuss alternatives to advertising.
{% endblocktrans %}
Expand All @@ -104,7 +112,8 @@ <h4>{% trans "Opting out" %}</h4>
<small>
{% blocktrans trimmed %}
If you are a company hosting commercial documentation on our community site,
we do not allow removing sponsor advertisements on your documentation.
we do not allow removing paid advertisements on your documentation.
Please consider Read the Docs for Business or a Gold Membership.
{% endblocktrans %}
</small>
</p>
Expand Down