Skip to content

Commit

Permalink
Merge pull request #753 from readthedocs/davidfischer/show-publisher-…
Browse files Browse the repository at this point in the history
…allowed-domains

Show the publisher's allowed domains
  • Loading branch information
davidfischer committed Jun 12, 2023
2 parents 7c716d0 + fa0b0c1 commit 5589c80
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions adserver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,9 @@ def daily_earn_cache_key(self):
today = get_ad_day().date()
return f"daily-earn::{self.slug}::{today:%Y-%m-%d}"

def allowed_domains_as_list(self):
return self.allowed_domains.split()

def total_payout_sum(self):
"""The total amount ever paid out to this publisher."""
total = self.payouts.filter(status=PAID).aggregate(
Expand Down
16 changes: 16 additions & 0 deletions adserver/templates/adserver/publisher/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ <h1>{% blocktrans %}Publisher settings for {{ publisher }}{% endblocktrans %}</h
<div class="row">

<div class="col-md-8 col">

{% if publisher.allowed_domains %}
<fieldset class="my-3 ">
<legend>{% trans 'Domains' %}</legend>
<ul>
{% for domain in publisher.allowed_domains_as_list %}
<li>{{ domain }}</li>
{% endfor %}
</ul>
<p class='form-text small text-muted'>
{% url 'support' as support_url %}
{% blocktrans %}These are your domains where ads may be displayed. Please <a href="{{ support_url }}?subject=New+Publisher+Domain">let us know</a> if you plan to run ads on additional domains so we may review them.{% endblocktrans %}
</p>
</fieldset>
{% endif %}

{% crispy form form.helper %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion adserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def ignore_tracking_reason(self, request, advertisement, offer):
)
reason = "Mismatched browser"
elif offer.publisher.allowed_domains and not is_allowed_domain(
offer.url, offer.publisher.allowed_domains.split()
offer.url, offer.publisher.allowed_domains_as_list()
):
log.log(
self.log_security_level,
Expand Down

0 comments on commit 5589c80

Please sign in to comment.