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

Commit fa951c5

Browse files
committed
point to new updateURL for themes on AMO (bug 641640)
1 parent 762efa3 commit fa951c5

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

apps/addons/models.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,29 +1683,36 @@ def footer_url(self):
16831683

16841684
@amo.cached_property
16851685
def update_url(self):
1686-
return settings.PERSONAS_UPDATE_URL % self.persona_id
1686+
locale = settings.LANGUAGE_URL_MAP.get(translation.get_language())
1687+
return settings.NEW_PERSONAS_UPDATE_URL % {
1688+
'locale': locale or settings.LANGUAGE_CODE,
1689+
'id': self.addon.id
1690+
}
16871691

16881692
@amo.cached_property
16891693
def theme_data(self):
16901694
"""Theme JSON Data for Browser/extension preview."""
16911695
hexcolor = lambda color: '#%s' % color
16921696
addon = self.addon
16931697
return {
1694-
'id': unicode(self.persona_id), # Personas dislikes ints
1695-
'name': addon.name,
1698+
'id': unicode(self.addon.id), # Personas dislikes ints
1699+
'name': unicode(addon.name),
16961700
'accentcolor': hexcolor(self.accentcolor),
16971701
'textcolor': hexcolor(self.textcolor),
16981702
'category': (addon.all_categories[0].name if
16991703
addon.all_categories else ''),
1700-
'author': self.author,
1701-
'description': addon.description,
1704+
# TODO: Change this to be `addons_users.user.display_name`.
1705+
'author': self.display_username,
1706+
'description': unicode(addon.description),
17021707
'header': self.header_url,
17031708
'footer': self.footer_url,
17041709
'headerURL': self.header_url,
17051710
'footerURL': self.footer_url,
17061711
'previewURL': self.thumb_url,
17071712
'iconURL': self.icon_url,
17081713
'updateURL': self.update_url,
1714+
'detailURL': self.addon.get_url_path(),
1715+
'version': '1.0'
17091716
}
17101717

17111718
@property

apps/addons/tests/test_models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,9 @@ def test_old_image_urls(self):
14651465
self.persona.footer_url)
14661466

14671467
def test_update_url(self):
1468-
ok_(self.persona.update_url.endswith(str(self.persona.persona_id)))
1468+
with self.settings(LANGUAGE_CODE='en-US'):
1469+
url_ = self.persona.update_url
1470+
ok_(url_.endswith('/en-US/themes/update-check/15663'), url_)
14691471

14701472

14711473
class TestPreviewModel(amo.tests.TestCase):

lib/settings_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ def JINJA_CONFIG():
972972
'%(tens)d/%(units)d/%(id)d/%(file)s')
973973
PERSONAS_USER_ROOT = 'http://www.getpersonas.com/gallery/designer/%s'
974974
PERSONAS_UPDATE_URL = 'https://www.getpersonas.com/update_check/%d'
975+
NEW_PERSONAS_UPDATE_URL = SERVICES_URL + '/%(locale)s/themes/update-check/%(id)d'
975976

976977
# Outgoing URL bouncer
977978
REDIRECT_URL = 'http://outgoing.mozilla.org/v1/'

sites/dev/settings_addons.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
PREVIEW_FULL_URL = (STATIC_URL +
2828
'img/uploads/previews/full/%s/%d.png?modified=%d')
2929
NEW_PERSONAS_IMAGE_URL = STATIC_URL + 'img/uploads/themes/%(id)d/%(file)s'
30+
NEW_PERSONAS_UPDATE_URL = SERVICES_URL + '/%(locale)s/themes/update-check/%(id)d'
3031

3132
# paths for uploaded extensions
3233
FILES_URL = STATIC_URL + "%s/%s/downloads/file/%d/%s?src=%s"

sites/prod/settings_addons.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
COLLECTION_ICON_URL = STATIC_URL + 'img/uploads/collection_icons/%s/%s.png?m=%s'
3737

3838
NEW_PERSONAS_IMAGE_URL = STATIC_URL + 'img/uploads/themes/%(id)d/%(file)s'
39+
NEW_PERSONAS_UPDATE_URL = SERVICES_URL + '/%(locale)s/themes/update-check/%(id)d'
3940

4041
MEDIA_URL = "%smedia/" % STATIC_URL
4142
ADDON_ICONS_DEFAULT_URL = MEDIA_URL + '/img/addon-icons'

0 commit comments

Comments
 (0)