Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow use of the dev device parameter for platform in feedback

  • Loading branch information...
commit 56eb2106b55ac71945bfb6bf5fca22b293e698ed 1 parent 28bdb37
@mattbasta mattbasta authored
Showing with 13 additions and 1 deletion.
  1. +4 −1 mkt/account/api.py
  2. +9 −0 mkt/account/tests/test_api.py
View
5 mkt/account/api.py
@@ -106,7 +106,7 @@ def post_list(self, request, **kwargs):
class FeedbackResource(PotatoCaptchaResource, CORSResource,
MarketplaceResource):
feedback = fields.CharField(attribute='feedback')
- platform = fields.CharField(attribute='platform', null=True)
+ platform = fields.CharField(attribute='platform', blank=True)
chromeless = fields.CharField(attribute='chromeless', null=True)
from_url = fields.CharField(attribute='from_url', null=True)
user = fields.CharField(attribute='user', null=True)
@@ -138,6 +138,9 @@ def hydrate(self, bundle):
"""
Add the authenticated user to the bundle.
"""
+ if 'platform' not in bundle.data:
+ bundle.data['platform'] = bundle.request.GET.get('dev', '')
@andymckay Owner

why can't we just make the api and client send the right data?

@chuckharmston Collaborator

I'm with @andymckay. This logic should be on the Fireplace side.

Per #859562 this endpoint isn't correctly returning the proper error message, but it should still be on Fireplace to send valid data.

@andymckay Owner

where are docs for this?

The Fireplace side was passing the dev parameter before this API was even written. If anything, we should be working on the "make the API match what's in flue because it already exists" task.

@andymckay Owner

that wasn't my comment :)

@andymckay Owner

And the marketplace has a platform value in feedback since 2012 when it was added by @cvan. If anything we should be working on making things consistent, not having something in flue because it was added there. I don't care if its platform or dev, but this sort of workaround isn't the way forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
bundle.data.update({
'user': bundle.request.amo_user,
'user_agent': bundle.request.META.get('HTTP_USER_AGENT', ''),
View
9 mkt/account/tests/test_api.py
@@ -219,6 +219,15 @@ def test_send(self):
eq_(unicode(self.user), data['user'])
eq_(mail.outbox[0].from_email, self.user.email)
+ def test_send_without_platform(self):
+ del self.default_data['platform']
+ import pdb; pdb.set_trace()
@cvan Owner
cvan added a note

LOL oh you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ self.list_url += ({'dev': 'platfoo'}, )
+
+ res, data = self._call()
+ self._test_success(res, data)
+ assert 'platfoo' in mail.outbox[0].body
+
def test_send_anonymous(self):
res, data = self._call(anonymous=True)
self._test_success(res, data)
Please sign in to comment.
Something went wrong with that request. Please try again.