Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Commit a347f3c

Browse files
committed
do not show Request Support links for old purchases (bug 710789)
1 parent de5ccbc commit a347f3c

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

apps/addons/templates/addons/listing/items_mobile.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h3>{{ addon.name }}</h3>
5656
<span>
5757
{% endif %}
5858
{% if contribs %}
59-
{{ refund_info(amo, addon, contributions, is_refunded, is_chargeback) }}
59+
{{ refund_info(amo, addon, contributions) }}
6060
{% endif %}
6161
</div>
6262
</details>

apps/addons/templates/addons/macros.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,16 @@
5858
{% endif %}
5959
{% endmacro %}
6060

61-
{% macro refund_info(amo, addon, contributions, is_refunded, is_chargeback) %}
61+
{% macro refund_info(amo, addon, contributions) %}
6262
{% set contributions = contributions.get(addon.pk, []) %}
6363
{% if contributions %}
64-
{% set get_support = not is_refunded and not is_chargeback %}
6564
<ul class="contributions">
65+
{% set last_contrib = contributions[-1].type == amo.CONTRIB_PURCHASE
66+
and contributions[-1].id %}
6667
{% for contribution in contributions %}
68+
{# Show "Request Support" link if this is the last contribution
69+
and is a purchase. #}
70+
{% set get_support = contribution.id == last_contrib %}
6771
<li>
6872
{% if contribution.type == amo.CONTRIB_PURCHASE %}
6973
<span class="purchase{{ ' supportable' if get_support }}">

apps/users/templates/users/purchases.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h3>
3333
{{ impala_reviews_link(addon) }}
3434
{{ price(addon) }}
3535
{{ sort_vital(addon) }}
36-
{{ refund_info(amo, addon, contributions, is_refunded, is_chargeback) }}
36+
{{ refund_info(amo, addon, contributions) }}
3737
</div>
3838
</div>
3939
<div class="action">

apps/users/tests/test_views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,9 @@ def _test_repurchased(self):
15791579
assert not item.hasClass('reversed'), (
15801580
"Unexpected 'refunded' class on '.item'")
15811581
assert not item.find('.refund-notice'), 'Unexpected refund message'
1582-
eq_(item.find('.purchase').eq(2).siblings('a').attr('href'),
1582+
purchases = item.find('.contributions')
1583+
eq_(purchases.find('.request-support').length, 1)
1584+
eq_(purchases.find('li').eq(2).find('.request-support').attr('href'),
15831585
reverse('users.support', args=[c[1].id]))
15841586

15851587
def test_repurchased(self):

0 commit comments

Comments
 (0)