Permalink
Browse files

remove apps preview code from apps/users

  • Loading branch information...
1 parent 6e18eb5 commit 1e3da4d105a2e62d0033a0f9026a853c2e17b85a @cvan cvan committed Mar 22, 2013
Showing with 46 additions and 822 deletions.
  1. +1 −4 apps/addons/templates/addons/listing/items_mobile.html
  2. +0 −44 apps/addons/templates/addons/macros.html
  3. +0 −1 apps/addons/templates/addons/paypal_error.html
  4. +1 −2 apps/addons/templates/addons/paypal_thanks.html
  5. +0 −9 apps/amo/context_processors.py
  6. +2 −3 apps/browse/tests.py
  7. +1 −75 apps/paypal/tests/test.py
  8. +3 −9 apps/users/forms.py
  9. +2 −4 apps/users/helpers.py
  10. +7 −22 apps/users/templates/users/edit.html
  11. +4 −13 apps/users/templates/users/includes/navigation.html
  12. +0 −25 apps/users/templates/users/mobile/purchases.html
  13. +0 −33 apps/users/templates/users/payments.html
  14. +5 −8 apps/users/templates/users/profile.html
  15. +0 −56 apps/users/templates/users/purchases.html
  16. +0 −3 apps/users/templates/users/support/author-sent.html
  17. +0 −25 apps/users/templates/users/support/author.html
  18. +0 −9 apps/users/templates/users/support/mobile/wrapper.html
  19. +0 −16 apps/users/templates/users/support/mozilla.html
  20. +0 −11 apps/users/templates/users/support/refund-sent.html
  21. +0 −11 apps/users/templates/users/support/refund.html
  22. +0 −34 apps/users/templates/users/support/request.html
  23. +0 −8 apps/users/templates/users/support/resources.html
  24. +0 −10 apps/users/templates/users/support/site.html
  25. +0 −25 apps/users/templates/users/support/start.html
  26. +0 −9 apps/users/templates/users/support/wrapper.html
  27. +14 −35 apps/users/templates/users/vcard.html
  28. +0 −10 apps/users/urls.py
  29. +6 −304 apps/users/views.py
  30. +0 −4 templates/mobile/header_auth.html
@@ -1,4 +1,4 @@
-{% from "addons/macros.html" import price, refund_info %}
+{% from "addons/macros.html" import price %}
{% set amo_user = request.amo_user if request.user.is_authenticated() else None %}
{% for addon in addons %}
{% if show_refunds %}
@@ -55,9 +55,6 @@
{{ _('Updated {0}')|f(addon.last_updated|datetime) }}
<span>
{% endif %}
- {% if contribs %}
- {{ refund_info(amo, addon, contributions) }}
- {% endif %}
</div>
</details>
</div>
@@ -58,50 +58,6 @@
{% endif %}
{% endmacro %}
-{% macro refund_info(amo, addon, contributions) %}
- {% set contributions = contributions.get(addon.pk, []) %}
- {% if contributions %}
- <ul class="contributions">
- {% set last_contrib = contributions[-1].type == amo.CONTRIB_PURCHASE
- and contributions[-1].id %}
- {% for contribution in contributions %}
- {# Show "Request Support" link if this is the last contribution
- and is a purchase. #}
- {% set get_support = contribution.id == last_contrib %}
- <li>
- {% if contribution.type == amo.CONTRIB_PURCHASE %}
- <span class="purchase{{ ' supportable' if get_support }}">
- {% trans date=contribution.created|datetime,
- amt=contribution.get_amount_locale() %}
- Purchased {{ date }} for {{ amt }}
- {% endtrans %}
- </span>
- {% if get_support %}
- <a class="request-support"
- href="{{ url('users.support', contribution.pk) }}">
- {{ _('Request Support') }}</a>
- {% endif %}
- {% elif contribution.type == amo.CONTRIB_REFUND %}
- <span class="purchase refund">
- {% trans date=contribution.created|datetime,
- amt=contribution.get_amount_locale() %}
- Refunded {{ date }} for {{ amt }}
- {% endtrans %}
- </span>
- {% elif contribution.type == amo.CONTRIB_CHARGEBACK %}
- <span class="purchase reverse">
- {% trans date=contribution.created|datetime,
- amt=contribution.get_amount_locale() %}
- Reversed {{ date }} for {{ amt }}
- {% endtrans %}
- </span>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- {% endif %}
-{% endmacro %}
-
{% macro sort_vital(addon, field) %}
{% if field in ('popular', 'downloads') or not addon.show_adu() %}
<div class="adu downloads">
@@ -19,7 +19,6 @@ <h5 class="error">{{ loc('Error with your purchase') }}</h5>
{% endwith %}
</section>
<section class="paypal-parent">
- <a href="{{ url('users.purchases') }}">{{ loc('My Purchases') }}</a>
{# TODO(marketplace-docs)
&middot;
<a href="{{ url('devhub.docs', doc_name='marketplace') }}">{{ loc('Marketplace Support') }}</a>
@@ -28,7 +28,7 @@
{% if waffle.flag('allow-pre-auth') and not amo_user.has_preapproval_key() %}
<section class="paypal-parent">
- <form form id="preapproval" method="post" action="{{ url('users.payments.preapproval') }}">
+ <form form id="preapproval" method="post">
{{ csrf() }}
<p>{{ loc('Want to do this faster next time?') }}</p>
<p>{{ loc('Setting up PayPal pre-approval allows you to buy apps quickly on this site. They also allow you to use in-app purchases that go through this site.') }}</p>
@@ -38,7 +38,6 @@
{% endif %}
<section class="paypal-parent">
- <a href="{{ url('users.purchases') }}">{{ loc('My Purchases') }}</a>
{# TODO(marketplace-docs)
&middot;
<a href="{{ url('devhub.docs', doc_name='marketplace') }}">{{ loc('Marketplace Support') }}</a>
@@ -7,7 +7,6 @@
import waffle
import amo
-from amo.helpers import loc
from amo.urlresolvers import remora_url, reverse
from amo.utils import memoize
from access import acl
@@ -74,14 +73,6 @@ def global_settings(request):
'href': reverse('collections.detail',
args=[amo_user.username, 'favorites'])})
- if waffle.switch_is_active('marketplace'):
- account_links.append({'text': _('My Purchases'),
- 'href': reverse('users.purchases')})
-
- if waffle.flag_is_active(request, 'allow-pre-auth'):
- account_links.append({'text': loc('Payment Profile'),
- 'href': reverse('users.payments')})
-
account_links.append({
'text': _('Log out'),
'href': remora_url('/users/logout?to=' + urlquote(request.path)),
@@ -846,8 +846,8 @@ def test_sidebar_extensions_links(self):
links = doc('#search-tools-sidebar a')
- eq_([a.text.strip() for a in links], [
- # Search Extensions
+ eq_([a.text.strip() for a in links],
+ [# Search Extensions
'Most Popular', 'Recently Added',
# Search Providers
'Bookmarks'])
@@ -1325,7 +1325,6 @@ def test_apps_mobile_auth_nav(self):
expected = [
(UserProfile.objects.get(username='regularuser').welcome_name,
None),
- ('My Purchases', reverse('users.purchases')),
('Log out', reverse('users.logout')),
]
self._test_auth_nav(expected)
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
-from cStringIO import StringIO
-from datetime import datetime, timedelta
from decimal import Decimal
import urllib
import urlparse
@@ -12,11 +10,9 @@
from nose.tools import eq_
import time
-from addons.models import Addon
-from amo.helpers import absolutify
-from amo.urlresolvers import reverse
import amo.tests
import paypal
+from addons.models import Addon
good_response = ('responseEnvelope.timestamp='
'2011-01-28T06%3A16%3A33.259-08%3A00&responseEnvelope.ack=Success'
@@ -457,76 +453,6 @@ def test_refunded_already(self, opener):
eq_(paypal.refund('fake-paykey')[0]['refundStatus'],
'ALREADY_REVERSED_OR_REFUNDED')
-# TODO: would be nice to see if we could get some more errors out of PayPal
-# but it looks like anything else just raises an error.
-good_preapproval_string = {
- 'responseEnvelope.build': '2279004',
- 'responseEnvelope.ack': 'Success',
- 'responseEnvelope.timestamp': '2011-12-13T16:11:34.567-08:00',
- 'responseEnvelope.correlationId': '56aaa9b53b12f',
- 'preapprovalKey': 'PA-2L635945UC9045439'
-}
-
-
-@mock.patch('paypal._call')
-class TestPreApproval(amo.tests.TestCase):
-
- def get_data(self):
- return {'startDate': datetime.today(),
- 'endDate': datetime.today() + timedelta(days=365),
- 'pattern': 'users.payments',
- }
-
- def test_preapproval_works(self, _call):
- _call.return_value = good_preapproval_string
- eq_(paypal.get_preapproval_key(self.get_data()),
- good_preapproval_string)
-
- def test_preapproval_no_data(self, _call):
- self.assertRaises(KeyError, paypal.get_preapproval_key, {})
-
- def test_preapproval_amount(self, _call):
- _call.return_value = good_preapproval_string
- data = self.get_data()
- paypal.get_preapproval_key(data)
- eq_(_call.call_args[0][1]['maxTotalAmountOfAllPayments'], '2000')
-
- data['maxAmount'] = 1000
- paypal.get_preapproval_key(data)
- eq_(_call.call_args[0][1]['maxTotalAmountOfAllPayments'], '1000')
-
- def test_preapproval_patterns(self, _call):
- _call.return_value = good_preapproval_string
- data = self.get_data()
- paypal.get_preapproval_key(data)
- eq_(_call.call_args[0][1]['cancelUrl'],
- absolutify(reverse(data['pattern'], args=['cancel'])))
- eq_(_call.call_args[0][1]['returnUrl'],
- absolutify(reverse(data['pattern'], args=['complete'])))
-
- @mock.patch.object(settings, 'PAYPAL_LIMIT_PREAPPROVAL', True)
- def test_preapproval_limits(self, _call):
- _call.return_value = good_preapproval_string
- data = self.get_data()
- paypal.get_preapproval_key(data)
- eq_(_call.call_args[0][1]['paymentPeriod'], 'DAILY')
- eq_(_call.call_args[0][1]['maxAmountPerPayment'], 15)
- eq_(_call.call_args[0][1]['maxNumberOfPaymentsPerPeriod'], 15)
-
- @mock.patch.object(settings, 'PAYPAL_LIMIT_PREAPPROVAL', False)
- def test_not_preapproval_limits(self, _call):
- _call.return_value = good_preapproval_string
- data = self.get_data()
- paypal.get_preapproval_key(data)
- assert 'paymentPeriod' not in _call.call_args[0][1]
- assert 'maxAmountPerPayment' not in _call.call_args[0][1]
- assert 'maxNumberOfPaymentsPerPeriod' not in _call.call_args[0][1]
-
- def test_preapproval_url(self, _call):
- url = paypal.get_preapproval_url('foo')
- assert (url.startswith(settings.PAYPAL_CGI_URL) and
- url.endswith('foo')), 'Incorrect URL returned'
-
# This data is truncated
good_personal_basic = {
View
@@ -254,7 +254,6 @@ class UserEditForm(UserRegisterForm, PasswordMixin):
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
- self.webapp = kwargs.pop('webapp', False)
super(UserEditForm, self).__init__(*args, **kwargs)
if self.instance:
@@ -265,14 +264,9 @@ def __init__(self, *args, **kwargs):
default.update(user)
# Add choices to Notification.
- if self.webapp:
- choices = email.APP_NOTIFICATIONS_CHOICES
- if not self.instance.is_developer:
- choices = email.APP_NOTIFICATIONS_CHOICES_NOT_DEV
- else:
- choices = email.NOTIFICATIONS_CHOICES
- if not self.instance.is_developer:
- choices = email.NOTIFICATIONS_CHOICES_NOT_DEV
+ choices = email.NOTIFICATIONS_CHOICES
+ if not self.instance.is_developer:
+ choices = email.NOTIFICATIONS_CHOICES_NOT_DEV
# Append a "NEW" message to new notification options.
saved = self.instance.notifications.values_list('notification_id',
@@ -69,10 +69,8 @@ def _user_link(user):
@register.filter
-def user_vcard(user, table_class='person-info', is_profile=False,
- webapp=False):
- c = {'profile': user, 'table_class': table_class, 'is_profile': is_profile,
- 'webapp': webapp}
+def user_vcard(user, table_class='person-info', is_profile=False):
+ c = {'profile': user, 'table_class': table_class, 'is_profile': is_profile}
t = env.get_template('users/vcard.html').render(**c)
return jinja2.Markup(t)
@@ -9,9 +9,7 @@
{% endblock %}
{% block content %}
-{% with webapp=webapp %}
- {% include 'users/includes/navigation.html' %}
-{% endwith %}
+{% include 'users/includes/navigation.html' %}
<div id="user_edit" class="primary prettyform grid" role="main">
<form method="post" action="" class="user-input island"
enctype="multipart/form-data">
@@ -140,8 +138,6 @@
{{ form.bio.errors }}
</div>
</fieldset> {# /.profile-detail #}
- {# TODO(apps): Revert this when we have collections for apps. #}
- {% if not webapp %}
<fieldset id="profile-misc" class="c">
<legend>{{ _('Miscellaneous') }}</legend>
<p class="sub_legend">
@@ -166,35 +162,24 @@
</li>
</ul>
</fieldset>
- {% endif %}
<fieldset id="acct-notify">
<legend>{{ _('Notifications') }}</legend>
<p class="sub_legend">
- {% if webapp %}
- {{ loc('From time to time, Mozilla may send you email. Please
- select the topics you are interested in.') }}
- {% else %}
- {% trans %}
+ {% trans %}
From time to time, Mozilla may send you email about upcoming
releases and add-on events. Please select the topics you are
interested in.
- {% endtrans %}
- {% endif %}
+ {% endtrans %}
</p>
<div class="user-notifications formfields">
{{ form.notifications }}
<p class="note">
- {% if webapp %}
- {{ loc('Mozilla reserves the right to contact you individually
- about specific concerns with your apps.') }}
- {% else %}
- {% trans %}
- Mozilla reserves the right to contact you individually about
- specific concerns with your hosted add-ons.
- {% endtrans %}
- {% endif %}
+ {% trans %}
+ Mozilla reserves the right to contact you individually about
+ specific concerns with your hosted add-ons.
+ {% endtrans %}
</p>
</div>
</fieldset>
@@ -1,20 +1,11 @@
{% set links = [
(_('My Profile'), amo_user.get_url_path()),
(_('Account Settings'), url('users.edit')),
+ (_('My Collections'), url('collections.mine'))
] %}
-{% if not webapp %}
- {% do links.append((_('My Collections'), url('collections.mine'))) %}
- {% if amo_user.favorite_addons %}
- {% do links.append((_('My Favorites'),
- url('collections.mine', 'favorites'))) %}
- {% endif %}
-{% endif %}
-{% if waffle.switch('marketplace') %}
- {% do links.append((_('My Purchases'), url('users.purchases'))) %}
-{% endif %}
-
-{% if waffle.flag('allow-pre-auth') %}
- {% do links.append((loc('Payment Profile'), url('users.payments'))) %}
+{% if amo_user.favorite_addons %}
+ {% do links.append((_('My Favorites'),
+ url('collections.mine', 'favorites'))) %}
{% endif %}
<div id="secondary-nav" class="secondary">
@@ -1,25 +0,0 @@
-{% extends "mobile/base.html" %}
-
-{% set title = _('My Purchases') %}
-{% block title %}{{ page_title(title) }}{% endblock %}
-
-{% block contentclass %}purchases{% endblock %}
-
-{% block page %}
- <h2>{{ title }}</h2>
- {% if single %}
- <div id="sort-menu">
- <a class="label" href="{{ url('users.purchases') }}">
- {{ _('Show all purchases') }}</a>
- </div>
- {% else %}
- {{ mobile_sort_by(request.path, selected=sorting, search_filter=filter) }}
- {% endif %}
- <div id="purchases" class="addon-listing">
- <ul class="listview">
- {{ addon_listing_items_mobile(addons.object_list, src='category',
- sort=sorting, show_refunds=True) }}
- </ul>
- </div>
- {{ addons|mobile_paginator }}
-{% endblock %}
Oops, something went wrong.

0 comments on commit 1e3da4d

Please sign in to comment.