Граф коммитов

490 Коммитов

Автор SHA1 Сообщение Дата
William Durand 9a129eb7a4
Update logging config (#14310) 2020-05-19 16:54:15 +02:00
Andrew Williamson 2b465a9e12 codestyle fixes 2020-05-15 14:42:50 +01:00
Andreas Wagner ee128b2ec5
Add creation date and id to django admin pages (#14189) 2020-05-06 23:17:53 +02:00
Andrew Williamson 261a40f4bf
Merge pull request #14121 from petercpg/0430_msgfix
typo fix: Firefox on Distribution Agreement -> Firefox Add-on Distribution Agreement
2020-04-30 10:18:59 +01:00
Peter Pin-Guang Chen 0db01bcbb5
typo fix: on -> Add-on 2020-04-30 11:57:14 +08:00
Mathieu Pillard 37bc4bc0a9 Remove leading/trailing newlines in translated content in emails 2020-04-29 12:44:48 +02:00
Mathieu Pillard 4f6095887c
Process all emails using Django Template Language, harmonize template paths (#14045)
* Process all emails using Django Template Language, harmonize template paths

* Fix EOL in test
2020-04-23 16:44:22 +02:00
Mathieu Pillard 2c6185cdf8 Use <input> for user admin actions to get django styles 2020-03-20 11:47:02 +01:00
Mathieu Pillard 20814c7024 Redirect to change url explicitly and not '../' after user admin action 2020-03-20 11:46:35 +01:00
Mathieu Pillard 20119e6486 Add action/button to reset user(s) session(s) in user admin 2020-03-18 12:58:19 +01:00
dbxnr dd816ce2db #13236 Remove Django 1.11 cache_get_or_set backport (#13244) 2020-01-14 11:31:46 +00:00
Mathieu Pillard 25f8888ba0 Prevent @search.mozilla.org to be used as a guid 2020-01-08 17:12:46 +01:00
mirefly 278f149f74 Add link to developer agreement page in corresponding API error 2020-01-06 10:33:51 -07:00
Andreas Wagner 45d67c4179
Update dev agreement change fallback date (#12986)
Update dev agreement change fallback date
2019-12-02 17:10:15 +01:00
Mathieu Pillard 5146229ac2 fix unused imports 2019-10-25 13:53:07 +02:00
Mathieu Pillard aee4d8a32c fix tests 2019-10-25 13:52:27 +02:00
Mathieu Pillard 9e35fd6bdf Remove UserForeignKey, making AddonUser FK more flexible 2019-10-25 11:42:34 +02:00
Mathieu Pillard 178a246347 Preserve IP addresses for deleted users for 6 months
Previously this was done only for banned users and their IP was kept
for a year, now this behavior applies to all deleted accounts, but
the delay is reduced to 6 months.
2019-10-03 13:13:38 +02:00
Andrew Williamson 2252f4cc3e initial django migrations 2019-09-12 16:25:13 +01:00
Mathieu Pillard 43e8746490
Allow admins to reset API keys for a developer or group of developers (#12319)
Allow admins to reset API keys for a developer or group of developers

This includes the API Credentials Confirmation state, so any affected
developers will have to go through the email confirmation again.
2019-09-10 17:07:10 +02:00
Mathieu Pillard 33eba49767
Declare some indexes that already exist on dev/stage/prod in our models (#12255)
Declare some indexes that already exist on dev/stage/prod in our models
2019-09-04 11:24:34 +02:00
Mathieu Pillard 45568eb34f
Add log statement when synchronizing an object with basket (#12203)
Add log statement when synchronizing an object with basket
2019-08-27 17:18:09 +02:00
Mathieu Pillard ea558652ff
Add override allowing users to bypass upload restrictions (#12182)
Add override allowing users to bypass upload restrictions

This should be set by admins in cases where a legitimate user is being blocked by one of our restrictions.
2019-08-27 12:44:42 +02:00
Mathieu Pillard 87aca127cf
Synchronize specific UserProfile, Addon and AddonUser changes with Basket (#12159)
Synchronize specific UserProfile, Addon and AddonUser changes with Basket
2019-08-21 12:50:22 +02:00
Andrew Williamson f8bc53f928
add a banned property for the date when a user is banned (#12083) 2019-08-12 17:00:54 +01:00
Mathieu Pillard fa7e12bb38 Minor visual tweaks on user restriction history in the user admin 2019-08-09 16:45:50 +02:00
Mathieu Pillard 154ce63b4a Merge remote-tracking branch 'devhub-adding-authors-confirmation' 2019-08-07 18:37:17 +02:00
Mathieu Pillard 3aa7fd2f50 Require confirmation from user being added as author to an add-on 2019-08-07 18:35:51 +02:00
Andrew Williamson 18a805baa7
remove more (all?) personas cruft (#12031)
* remove more (all?) personas cruft

* _ADDON__PERSONA to _ADDON_PERSONA
2019-08-06 19:39:20 +01:00
Mathieu Pillard 3b2dde200d
Merge pull request #12029 from diox/record-submission-restrictions-failures
Record submission restriction failures
2019-08-06 15:09:35 +02:00
Mathieu Pillard 708488c62e Record submission restriction failures 2019-08-05 18:22:47 +02:00
Mathieu Pillard 40c04548d3 Clear last_login_ip on users deleted for more than a year 2019-08-05 14:08:31 +02:00
Andrew Williamson 56c553a11b
add a comment 2019-07-23 15:00:27 +01:00
Andrew Williamson ebf80ced35
don't pass a set to `index_addons.delay` 2019-07-23 13:23:51 +01:00
Christopher Grebs 2de22598bd
Remove all usage of 'six' and as much compat code as I could f… (#11730)
* Remove all usage of 'six' and as much compat code as I could find.

Cleans up some imports along the way.

Fixes #11728

* Fix typo

* Fix rta related code paths, I actually misread the comment…

* Move ResourceWarning filtering to setup.cfg
2019-07-16 12:01:31 +02:00
Andreas Wagner 5300d01a67
Address reviewer comments 2019-07-13 14:44:57 +02:00
Andreas Wagner 749c7fa4ec
Add check for user 2019-07-12 15:30:09 +02:00
Andreas Wagner c99cb8a643
Add test 2019-07-12 14:13:18 +02:00
Andreas Wagner 375487f04c
Match last login ip against ip filter 2019-07-12 13:48:17 +02:00
Christopher Grebs e4dd670b6b
Change email restriction error message (#11799)
Fixes #11760

* Change email restriction error message
* minor tweeks
2019-07-11 10:45:11 +02:00
Andreas Wagner 51c5f568e7
Update logging (#11805)
Update logging
2019-07-09 17:56:29 +02:00
megha-kumarii 8c2bf01ea9 minor tweeks 2019-07-05 17:49:30 +05:30
Christopher Grebs c0ec7fd362
Use a group+permission to manage langpack submission. (#11798)
* Use a group+permission to manage langpack submission.

Modifies some tests to use a minimal webextension langpack along the way

Fixes #11793

* Forgot to update one test.
2019-07-05 13:55:40 +02:00
megha-kumarii c1b1219bc6 Change email restriction error message 2019-07-05 16:47:40 +05:30
Mathieu Pillard a9b899c864 Disallow submission of langpacks from 3rd party developers 2019-07-04 18:07:37 +02:00
Mathieu Pillard 533863e30c Apply upload restrictions to known disposable email providers
Use a new model to make it easier on the db (don't have to load
everything since there are no wildcards to support, we can just
do a single efficient db query)
2019-07-02 17:58:41 +02:00
Mathieu Pillard 9ddb2deea5
Normalize emails when checking restrictions (#11756)
Normalize emails when checking restrictions
2019-07-02 16:57:42 +01:00
Mathieu Pillard 805ace4a2f
Merge pull request #11719 from diox/average-addon-rating-deleted-ratings
Don't consider deleted ratings when computing user average addon rating
2019-06-27 15:48:48 +02:00
Mathieu Pillard 30166b99bf Don't consider deleted ratings when computing user average addon rating 2019-06-26 17:55:06 +02:00
Andreas Wagner bc6e5c5390
Update dev agreement fallback date (#11679)
Update dev agreement fallback date
2019-06-21 15:24:51 -07:00
Mathieu Pillard c3ca15835f
Query iprepd for email and ip restrictions on top of our own (#11613)
Query iprepd for email and ip restrictions on top of our own
2019-06-11 17:35:27 +02:00
Mathieu Pillard 6a0c591483
Merge pull request #11588 from diox/abuse-admin-links
Fix links used in abuse report admin tool to be absolute
2019-06-07 12:34:37 +02:00
Andreas Wagner 20d97a27ab
Keep IP when banning user 2019-06-06 13:13:19 +02:00
Mathieu Pillard 99bb89783b Fix links used in abuse report admin tool to be absolute
The admin lives on an instance that doesn't support the rest of the
app so any links pointing to outside the admin need to be absolute.
2019-06-06 13:03:17 +02:00
Mathieu Pillard a391064a8d
Prevent adding new author to an add-on if its email is restricted (#11556) 2019-06-03 12:14:27 +02:00
Mathieu Pillard 20ed9133ed Require users to set a display name when validating developer agreement 2019-05-31 13:52:25 +02:00
Mathieu Pillard 9d58c52849 Give access to ip network/email restrictions to advanced admins and fix __str__ 2019-05-23 09:39:18 +02:00
Christopher Grebs 011cc130e2
Rework email blocking to allow blocking whole domains too. (#11483)
* Rework email blocking to allow blocking whole domains too.

This works very basically also for subdomains.

This doesn't support wildcards.

Fixes #11442

* Use fnmatch to match on glob-style patterns.

Fixes #11484

* Fix tests and flake8

* Rename domain_pattern to email_pattern as that fits better.

* just change the email column

* Fix migration number

* fix admin
2019-05-22 20:10:55 +02:00
Mathieu Pillard b8fffcca8e Restrict submissions per user email or IP
This forces restricted users (from their email or current IP) to go to the
developer agreement page when they want to use the submission flow. When
the agreement page is submitted, they'll be shown a message depending on
the reason behind the restriction.

A new API permission is also added that completely prevents the signing API
from allowing requests from such restricted users, with the corresponding
message returned as well.
2019-05-21 15:40:36 +02:00
Christopher Grebs 458af2d55a
First part of adding user restriction model and basic admin. (#11465)
* First part of adding user restriction model and admin.

This adds a `UserRestriction` model that allows admins to add
restrictions based on ip-address, cidr network or email.

The admin is currently very basic and will most certainly be improved
over time.

Fixes #11440 (already contains CIDR support)
Refs #11442 (missing email domain support, going to push that in a
follow-up)

* Split up user restriction checkers. Add actual allow_* implementation and tests

* Improve tests, fix /32 blocking

* Merge IPAddressUserRestriction and IPNetworkUserRestriction
2019-05-20 15:59:22 +02:00
Mathieu Pillard 6ac30c699b
Make Abuse Report Admin search depend on report type being searched (#11438)
Make Abuse Report Admin search depend on report type being searched
2019-05-20 10:38:32 +02:00
Andrew Williamson c3a658b4c6
optimize bulk user banning (#11388) 2019-05-14 17:01:38 +01:00
Andrew Williamson 7629b2f4c0
replace mock dep with native unittest.mock (#11313) 2019-05-03 14:31:44 +01:00
Andrew Williamson 665d45df3d
STATUS_PUBLIC to STATUS_APPROVED (#11249) 2019-04-25 20:58:03 +01:00
Mathieu Pillard 7d9134de25 Fix ban_action permission check in user admin
We should never hit that code in real life for now, as you need Users:Edit
permission to see the list anyway, but this was wrong. (There is an
additional permission check in the method itself so there wasn't any
security risk)
2019-04-23 16:47:58 +02:00
Andrew Williamson 6808451b25
remove legacy unsubscribe page + other users app clean-up (#11214) 2019-04-18 12:43:10 +01:00
Mathieu Pillard 8105d68ce4 Don't make extra SQL queries when calling is_superuser multiple times 2019-04-16 15:20:45 +02:00
Andrew Williamson 640f9696b3
drop legacy home view (#11148) 2019-04-04 19:57:20 +01:00
Mathieu Pillard 968ec0b5e9
Remove obsolete management commands / tasks (#11145)
- approve_addons (made obsolete by auto_approve)
- award_post_review_points (one-off)
- commentlog (one-off)
- migrate_abuse_reports_to_country_code (one-off)
- process_addons --task=bump_appver_for_legacy_addons (one-off)
- process_addons --task=disable_legacy_files (one-off)
- process_addons --task=migrate_legacy_dictionaries_to_webextension (one-off)
- process_addons --task=remove_amo_links_in_url_fields (one-off)
- search_platforms (one-off)
- update_deleted_users (one-off)
- versionlog (one-off)
2019-04-04 16:31:28 +02:00
Andrew Williamson fe7ebc484d
have get_absolute_url be absolute, and return an external site url (#11032) 2019-04-04 11:07:38 +01:00
Mathieu Pillard 49ffbfb213
Merge pull request #11088 from diox/reviewer-alias
Add reviewer name alias for reviewers to hide their actual name
2019-04-03 13:02:10 +02:00
Mathieu Pillard 90c8201eb9 Add reviewer name alias for reviewers to hide their actual name
It's used when exposing reviewer name to developers for reviewer
actions - regular actions still use the normal name, even when
made by a reviewer.
2019-04-01 13:07:12 +02:00
Andrew Williamson 01f267050b
rm all the legacy addon views (#11086) 2019-04-01 11:02:38 +01:00
Andrew Williamson abe16fed54
restore widget_attrs for UserEmailField (+rename) (#10915) 2019-03-12 12:57:57 +00:00
Andrew Williamson 69d43bb369
More django2.2 fixes (#10793) 2019-03-07 17:39:28 +00:00
Andrew Williamson 74794d9db5
rm /users/views.py etc (#10833) 2019-03-05 09:58:09 +00:00
Andrew Williamson 20328da9e4
frontend has the user admin edit url in a slightly different location (#10829) 2019-03-04 09:46:16 +00:00
Shivam Singhal 3f247f4d41 Update django-multidb-router terminology (#10773) 2019-03-01 10:37:13 +00:00
Andrew Williamson 32e546c7c0
move olympia logout page to devhub; remove login/register views (#10686) 2019-02-18 17:21:45 +08:00
Mathieu Pillard a3e12790e3
Merge pull request #10696 from diox/point-my-collections-legacy-link-to-new-url
Point My Collections to the collection homepage for frontend compat
2019-02-15 17:03:32 +01:00
Shivam Singhal 600fe38b5a Remove sdk based addons notifications code (#10568) 2019-02-15 22:46:31 +08:00
Mathieu Pillard f2c4c16c8d Point My Collections to the collection homepage for frontend compat
The individual collection pages no longer exist in the new frontend,
so we need this link to point to something that does and this is the
one that makes the most sense.
2019-02-15 15:44:37 +01:00
Andrew Williamson cd57dee443
django2.2 changes and deprecation removals (#10700) 2019-02-15 22:41:03 +08:00
Andrew Williamson b25df7e852
address django2 feature removals (#10691) 2019-02-14 18:31:46 +08:00
Andrew Williamson a0a35a1fe5
address (mainly django) deprecation warnings (#10667) 2019-02-12 21:03:16 +08:00
Mathieu Pillard 5fae59878d Fix RemovedInDjango21Warning: Add the renderer argument to the render() method 2019-02-05 18:15:22 +01:00
Andrew Williamson ade65418e7
Fix /users tests (#10450) 2019-01-19 00:13:30 +08:00
Christopher Grebs c97fdc3af1
Use a temporary 302 redirect in LocaleAndAppURLMiddleware. (#10447)
Fixes #10444
2019-01-18 12:28:18 +01:00
Andrew Williamson 791f6bea4c
various python3 related fixes (#10435) 2019-01-17 22:45:06 +08:00
Mathieu Pillard 6204704e23 Replace __unicode__ with __str__, using @python_2_unicode_compatible where needed 2019-01-17 11:50:55 +01:00
Andrew Williamson 96d87a9391
drop username editing (#10329) 2019-01-09 19:18:03 +08:00
Mathieu Pillard dcda1977fc Replace iter* with six.iter* for Python 3 compat 2019-01-08 14:39:49 +01:00
Mathieu Pillard 8a6bc453c6 Replace usage of StringIO with six.StringIO for Python 3 compat 2019-01-08 14:27:40 +01:00
Mathieu Pillard f79652d396 Fix pep8 issues following Python 3 compat commits 2019-01-08 13:40:51 +01:00
Mathieu Pillard 1caa3440cc Replace usage of xrange() by range() for Python 3 compat 2019-01-08 13:40:51 +01:00
Mathieu Pillard 521945867e Replace reduce by functools.reduce for Python 3 compat 2019-01-08 13:40:51 +01:00
Mathieu Pillard d046261151 Replace usage of `basestring` with `six.string_types` for Python 3 compat 2019-01-08 13:40:51 +01:00
Mathieu Pillard 9cfd298284 Replace usage of `unicode` with `six.text_type` for Python 3 compat 2019-01-08 13:40:50 +01:00
Mathieu Pillard 70760159c3 Replace urlparse imports by six.moves.urllib_parse for Python 3 compatibility
This keeps backwards-compatibility to Python 2 but moves us closer to running
with Python 3.
2019-01-07 17:43:17 +01:00
Andrew Williamson 3258a760dc
display_name limited to between 2 and 50 characters (#10270) 2019-01-02 23:14:27 +00:00
Andrew Williamson f9eb5f9a63
always use UserProfile.name to get always get a name (display_name can be '') (#10264) 2019-01-02 10:48:28 +00:00
Andrew Williamson dd733fe76c
stop using username as a fallback when display name isn't set (#10262) 2019-01-02 10:15:48 +00:00
Andrew Williamson f6b7fd42b4
stop using usernames in collections too (#10173) 2018-12-07 11:39:45 -05:00
Andrew Williamson 438439b705
use UserProfile.id in urls rather than username (#10103) 2018-11-28 15:47:26 +00:00
Christopher Grebs 83f1b2707d
Merge pull request #10042 from mozilla/8602-use-memcached-by-default-in-tests
Enable memcached by default for tests. Upgrade python-memcached
2018-11-21 19:29:36 +01:00
Christopher Grebs 2c82ea7728
Enable memcached by default for tests. Upgrade python-memcached
* Adds a test to test unicode support for latest python-memcached
  versions
* Configures caches key prefix so that tests don't conflict with each other
* Remove a few cache.clear calls with `cache.delete` calls that avoids
deleting all memcached entries while other tests are running
* Remove zadmin.memcached as it's crazy dangerous, such power should
only be wielded by ops-folks who wake up at night when pressed
* Fixes waffle helpers to call .flush() to flush appropriate caches

This also fixes how parameters are forwarded to memcached and fix KEY_PREFIX initialization

We are now making sure parameters from `settings.CACHES` are properly forwarded
to the actual cache backend (now memcached). These errors were not seen
since LocMemCache didn't require any parameters.

The `KEY_PREFIX` setting is set to a uuid instead of the xdist-slaveid to
ensure test functions are properly isolated from each other.

`cache.clear` is not called anywhere unless absolutely necessary to reduce
the side-effects of our test-setup.

Fixes #8602
2018-11-21 18:26:30 +01:00
Mathieu Pillard a23f38ed36 Expose more info about ratings in admin, allow admins to delete them 2018-11-21 14:01:04 +01:00
Christopher Grebs 8d4d9504b2
Remove 'activate-basket-sync' waffle switch and implementation
Fixes #10025

This doesn't touch how notifications are synced to `UserNotification`
instances but only uses basket always.
2018-11-20 09:22:12 +01:00
pyup.io bot 60dd98e48f Update flake8 to 3.6.0 (#9795) 2018-11-05 12:39:42 +00:00
Andreas Wagner 55323c43a9
Accept multiple ids when searching for user 2018-10-28 15:29:47 +00:00
Andrew Williamson 534e8f56f9
unsigned, PositiveAutoFields (#9377) 2018-09-24 07:47:03 +01:00
Christopher Grebs 92e9fb2aed
Fix deprecation warnings (Django 2.x, DRF etc) (#9431)
This should fix most of our current Django 2.x and DRF deprecation warnings that we see during test runs.

* Uses `remote_field.model` in amo/utils instead of `remote_field.to`
* Uses `is_anonymous` and `is_authenticated` as properties instead of functions
* Replaces drf `@detail_route` with `@action(detail=True)`

Fixes #9432
2018-09-17 09:24:14 +02:00
Yash Sharma 38490d351e Making e-mail restrictions case insensitive (#9426)
Make @mozilla.com|org guids restriction case-insensitive
2018-09-14 22:55:12 +02:00
Mathieu Pillard 9e1bfea859 Add @mozilla.com to the list of add-on guids restricted to mozilla users 2018-09-04 17:49:53 +02:00
Benjamin Forehand Jr 80bbc69dfd
Added configuration to run multiple ui tests in parallel. (#9266)
* Changed fxa account generation to allow assigning an fxa ID to a created user.
* Moved pytest execution to makefile to access variables.
* Removed second login tests as the devhub tests also log in.
2018-08-28 14:48:35 -04:00
Yash Sharma 78bc6607b9 Use Firefox user instead of Anonymous user when user doesn't have a display name 2018-08-27 20:05:37 +05:30
Mathieu Pillard c09a7fc1ae Allow users with Admin:Advanced to delete users with relations to other models
Note that the behaviour depends on which model is affected - some are kept,
others are deleted because of UserProfile.delete_or_disable_related_content().
2018-08-21 14:57:10 +02:00
Mathieu Pillard d1a5fe81fb Make sure last_login and last_login_ip are always set (#9120)
- Refactor auth register and login to *both* send `user_logged_in` signal
- Use that signal to set `last_login_ip` (django uses it to set `last_login`)
- Also send that signal when authenticating through JWT tokens
- Deprecate the `*_attempt` fields that no longer make sense with FxA auth

Fix #7333
2018-08-14 08:02:14 +02:00
Mathieu Pillard 060b4a01e2 Redirect legacy login page to URL passed in query if authenticated 2018-08-08 16:03:02 +02:00
Mathieu Pillard d3e7c31caf Fix test broken by listed_authors transformer change 2018-08-02 16:32:05 +02:00
Mathieu Pillard 0ab1a95f5d
Merge pull request #9000 from diox/remove-update-collections-votes
Remove more obsolete collection features: stats, downloads, watchers & votes
2018-07-30 13:56:36 +02:00
Mathieu Pillard eba5e64422 Remove more obsolete collection features: stats, downloads, watchers & votes. 2018-07-30 13:39:38 +02:00
Mathieu Pillard c34bdab7e4 Work around string extraction issue in user admin 2018-07-23 12:24:52 +02:00
Benjamin Forehand Jr cafc5d0519
Add UI devhub login and upload tests (#8559)
* Added devhub login and upload tests.
* Add ui-test webext.
* Remove management commands.
2018-07-13 08:55:40 -04:00
Andrew Williamson fc73214810
count static themes as themes too (#8870) 2018-07-13 13:30:38 +01:00
Andrew Williamson 1accc2b18c
don't try to include set notifications from the db that don't exist anymore. (#8871) 2018-07-13 12:37:19 +01:00
Christopher Grebs 7407b70aa2
Update to Django 1.11 (#8738)
Port code and tests to Django 1.11.

* Update requirements to Django 1.11.14, remove session_csrf
* Use --run-syncdb for migration calls
* Remove unused setup-docker script
* Port code and tests to Django 1.11.
* Remove django-session-csrf everywhere, it got replaced by django's own
  session csrf protection
* Make sure we are calling `client.get()` with `follow=True` where necessary
* Replace django.core.urlresolvers import with django.urls
* Port custom `IconWidgetRenderer` to Django 1.11 as `IconTypeSelect`
* Properly use `_queryset_class` for custom manager classes
* Make use of `base_manager_name` on our models `Meta` instead of `use_for_related_objects`
  on the manager where appropriate. This is required to make translations, soft-delete
  and more work. See comment on Addons.Meta for more details.
* Various fixes along the way to make tests work
* Port form errors for locale editing forms to Django 1.11 and make use of
  form.add_error instead of our own custom process
* Mark TestDetailPage.test_304 as xfail for now, somehow Etags seem to be broken
  for that view during tests but work fine in manual tests
* Fix amo.celery, we cannot have any imports at the module-level that may
  import the ORM
* Fix global_settings context processor for 500-server error cases
* Fix `changed_data` handling in `AMOModelForm`
* Remove `queryset_transform` and implement it directly in amo/models
* Fix pagination, Django changed how `num_pages` work and how `count` can be overwritten
* Add a new test that tests database transforms as `BaseQuerysetTestCase`
* Make sure `legacy_redirect` only appends `?` if there are actual GET parameters
* Re-implement `LicenseRadioChoiceInput` as `LicenseRadioSelect` which is now Django 1.11 compatible
* Remove our custom `form_kwargs` uplift from Django 1.9
* Correct how we're using `Category.objects.create` and only pass `db_name` instead of `name`, previously
  this didn't error but now it (luckily!) does
* Update `FileSelectWidget` to correctly work with Django 1.11, use custom rendering
* Fix decorator ordering for `files.views:browse`
* Update database settings to correctly use `TEST` object
* Fix `select_related` call in `RatingViewSet`
* Remove custom `DateTimeCast` implementation
* Fix `addon_factory` calls in `reviewers/tests/test_views.py` to correctly set
  `is_webextension`
* Port our `TranslationDescriptor` and `TranslatedField` to Django 1.11. Also, make sure form error handling works
* Add a new test that checks that `default=None` is a valid setting for translation fields
* Add a new test that checks that translations from related fields are correctly fetched
* Remove possible ambiguity from translations `TestWidget` tests
* Make sure that the correct `MEDIA_URL` is set in `TestDownloadsUnlistedVersions` to fix
  external cdn tests

* Remove custom happyforms code. Django cleans text fields now by default
* Move translations app to the top of INSTALLED_APPS, add a lengthy comment
* Pass additional arguments to contribute_to_class, fix smaller nits
* Set MEDIA_URL and STATIC_URL to an external value by default. That's how they're configured in dev, stage and prod anyway.

Please note that we didn't replace all our custom form rendering with proper templated widgets yet. This will
happening in some follow-up work.

Fixes #5271, Fixes #1569
2018-07-11 06:56:54 +02:00
lavish205 0aad639ef4 Fixed #8644: Unify @write and @use_master into one @use_primary_db decorator 2018-07-09 18:07:05 +05:30
Andreas Wagner c1f35fbefb
Add link to admin userprofile on admin membership page 2018-07-02 19:56:11 +02:00
Mathieu Pillard 8c03d67bba Add actions to the user admin (delete picture, ban user, delete user)
This in turns means adding the notion of banned users and preventing
them from logging on. They are just deleted users for which we keep
the email and fxa_id.
2018-06-29 12:54:03 +02:00
Mathieu Pillard 401a073f38 Enable session key rotation for django authentication 2018-06-28 13:44:24 +02:00
Mathieu Pillard 1205979db9 Rename UserProfile reviews property to ratings 2018-06-28 13:44:24 +02:00
Christopher Grebs ceae9d4fd0
Remove cache machine (#8606)
Fixes #7743
2018-06-28 13:20:06 +02:00
Christopher Grebs aaf9bf7689
Backport Django 1.11 cache.get_or_set (#8549)
Part of our upgrade to Django 1.11, this is backporting functionallity
we'd like to use after the upgrade already to our current code so that
we can find potentially drawbags early.

This also reduces our reliance on cache-machine which helps removing it.

This also few smaller optimizations along the way:

 * denied-name blocklists were cached language-dependend although they're not, this now increases the chance of cache-hits instead of misses
 * the django cache.get_or_set implementation fixes potential
 race-conditions between multiple requests setting data

Fixes #8529
2018-06-19 09:24:31 -07:00
Christopher Grebs a3b9bcd009
Remove template fragment caching. (#8461)
* Remove template fragment caching.

* Removes template fragment-caching completely
* Adds a few performance optimizations, backported from #8435
* Removes the globally available `ADMIN_MESSAGE` and explicitly fetches
it in our base template. That way we don't call zadmin.get_config on
every template-render needlessly
* Improved developer-status querying, merged the caching from is_developer, is_addon_developer, and is_artist

Fixes #8460

* Actually remove amo.ext module.

* Revert not fully-completed addons_with_authors rework

* Fix comment
2018-06-12 23:05:38 +02:00
Andrew Williamson 7befdbaefc
Update text on legacy profile page to indicate how emails can be changed. (#8466) 2018-06-08 09:30:48 +01:00
Andrew Williamson ddc71a8128
Only return dev notifications for addon developers. (#8427) 2018-06-05 12:38:19 +01:00
Andrew Williamson b457a5cece
some py3 friendly syntax changes (#8372) 2018-05-30 11:29:13 +01:00
Christopher Grebs 1527d1542f
Add optin and source_url parameters to basket integration. (#8363)
* Add optin and source_url parameters to basket integration.

Fixes #8320

* Make request optional
2018-05-29 13:08:31 +02:00
Mathieu Pillard 6e2e1a61c1 Fix update_user_ratings_task() (it can receive rating as a string) 2018-05-28 18:48:09 +02:00
Mathieu Pillard 410e714083
Merge pull request #8335 from diox/user-admin
Expand the user admin with more information, give access to people with Users:Edit
2018-05-25 15:39:55 +02:00
Mathieu Pillard 75a24cc23a Expand the user admin with more information, give access to people with Users:Edit 2018-05-23 19:49:21 +02:00
Mathieu Pillard 1bb9e43dae Always display notification state from basket, don't trust our own data
2 things were wrong here:
- We didn't use basket data if the state was 'unsubscribed'
- We didn't check against the basket_id so the if was never True

The form had both mistakes, the API only the second one.
2018-05-23 19:26:31 +02:00
Mathieu Pillard cea8a9c2ee
Switch celery task serialization from pickle to JSON (#8178)
Switch celery task serialization from pickle to JSON
2018-05-23 14:42:29 +02:00
Mathieu Pillard 7e3f9db93c Let basket exceptions be raised and subscribe synchronously
Swallowing basket errors or letting it do async calls is
dangerous for us, because the user is not aware if something
went wrong. Better for them to get a 500 page if things are
not working properly.
2018-05-21 19:36:35 +02:00
Christopher Grebs a27d4116b4
Fix user deletion to not generate a potentially used username
Fixed #8289
2018-05-17 20:19:18 +02:00
Christopher Grebs 7d7375bd62
Fix basket integration for unknown users. (#8283)
* Fix basket integration for unknown users.

Fixes #8281

This also removes the orphaned sync_user_with_basket task. We do that
synchronisation on-demand and during the request when a user calls
it's user profile page.

* Return empty list and don't return empty tuple when sync on unsubscribe didn't work
2018-05-17 13:35:06 +02:00
Shivam Singhal a1db1e4871 Fix: Removing notifycompat & notifyevents (#8258) 2018-05-16 19:01:26 +01:00
Christopher Grebs 328da3ea67
Clear more personal data on user deletion. (#8225)
* Clear more personal data on user deletion.

Fixes #8223

* Fix failing test thanks to modified fixture data

* Also delete photos on user deletion.

Fixes #8222

* Add a command that re-calls user.delete() on all deleted users.

* No need anymore to name the task explicitly

* Fix flake8, correctly delete user-images in case of hard delete

* Fix docstring
2018-05-14 11:56:03 +02:00
Christopher Grebs 1500c53305
Implement basket <-> amo newsletter sync (#8174)
* Implement basket <-> amo newsletter sync.

* Adds basket-client dependency
* Refactors users.notifications to allow for remotely-managed
  notification types
* Implement helpers to fetch, subscribe and unsubscribe from newsletters
* Update user profile editing form to fetch and save to basket
* Update accounts/notifications endpoint to fetch and save to basket
* Implement a sync_basket command that fetches basket tokens
asynchronously for all users

All this is behind a waffle flag.

Fixes #7808

* Switch to 100% synchronous basket requests again

* Fix accounts view test to use the conftest configured token

* Fix typos and comments

* Put basket integration behind waffle flag

* Fix typo

* Fix tests

* Remove sync_basket command

* Fix flake8
2018-05-09 17:53:35 +02:00
Benjamin Forehand Jr 2244f9ae10
Added option to add an fxa account id to a super user on creation. (#8161)
* Added option to add an fxa account id to a super user on creation.
2018-05-04 11:02:22 -04:00
Christopher Grebs 6a8fc341da
Remove cache-machine helpers, switch to django cache backends (#8122)
* Implement cache request tracking, add zadmin config tests.

Implements CacheStatTracker as a backend for tests to allow us to use
`assert_cache_requests` in tests.

* implement a `cached` helper and removes caching.{cached,cached_with} instances.
* change from caching backends back to django cache backends

* Move cache_helpers -> cache_nuggets

* Fix CacheStatTracker to not remove OPTIONS values
2018-04-25 16:04:20 +02:00
Mathieu Pillard 1d32388bc7 Allow superusers to see django admin modules nobody else can access 2018-04-03 12:39:20 +02:00
Mathieu Pillard de5dd57d83
Move "staff" admin into regular django admin & add Admin:Curation permission (#7875)
Move "staff" admin into regular django admin & add Admin:Curation permission

In addition, to allow this to happen, refactor the way we deal with django
permissions as needed by the django admin, by adding a mapping to our own
permissions system. At the moment the only mapping really needed is for
Admin:Curation, which allows full access to ReplacementAddon objects in
the admin.

Because the django admin can now properly show you and give you access
to only what you have the permissions for, the "staff" admin is no longer
necessary and removed in this commit.
2018-03-28 15:16:21 +02:00
Andreas Wagner 8dd20c4960
Upate last dev-agreement change date for new review policies (#7903)
Upate last dev-agreement change date for new review policies
2018-03-27 15:15:23 +02:00
Mathieu Pillard 1ca2041cb7 Store averagerating as a float directly, not a string containing a float 2018-03-23 16:53:34 +01:00
Mathieu Pillard 28b3fb83fe Convert UserProfile's addon average rating to float to match other models 2018-03-23 13:47:48 +01:00
Mathieu Pillard 244fb08076
Merge pull request #7836 from rafspiny/bug/7731-wrong-math-photo-size
Compute the right photo limit size. Adding a test for this exploting …
2018-03-19 11:36:50 +01:00
rafspiny 29629cbc8d Making the code style complaint. 2018-03-18 22:41:15 +01:00
rafspiny 5d42686b63 Compute the right photo limit size. Adding a test for this exploting Mock. Fix #7731 2018-03-17 00:38:33 +01:00
Sanyam Khurana 35386e9aed Fixes #7679: Change anonymous user image url/picture_type to a null value (#7715) 2018-03-10 21:20:03 +08:00
rafspiny 21936d5368 Adding a test to make sure we cannot change the display_name to a denied one. Ref #7449 2018-03-06 22:38:59 +01:00
Mathieu Pillard 8d4520063d Use IMG_TYPES constant whenever possible 2018-02-23 17:18:11 +01:00
Mathieu Pillard 1697787b91 Prevent uploads of non images for user photo and collection icon 2018-02-22 18:36:57 +01:00
Andrew Williamson dc9a6678ef
save original uploads of icons and previews too (#7586) 2018-02-17 02:21:09 +08:00
Christopher Grebs 7d8d74ee3b
Make delete user copy more clear about what happens if you log in again.
Fixes #2451
2018-01-30 14:32:19 +01:00
Andrew Williamson 3d8bc5bede
Remove Viewer and Support add-on author roles. (#7384) 2018-01-29 23:02:34 +08:00
Mathieu Pillard d0173591ee Invalidate old sessions when soft-deleting a user account 2018-01-22 16:41:59 +01:00
Vishal Sharma 181b976ab1 Added appropiate spacings in users email templates. (#7237) 2018-01-09 19:09:34 +00:00
Mathieu Pillard 22f5c44f42 Avoid one-letter variable for addon in list comprehension 2018-01-08 15:51:19 +01:00
Mathieu Pillard 1a57ed8b42 Reindex add-ons when authors username/display_name changes 2018-01-08 15:16:03 +01:00
Christopher Grebs 57915e2480
Add isort to our codebase. (#7118)
* Add isort to our codebase.

This is the first draft, please feel free to discuss this but I'm
generally open to change that style later on.

I just want to start making more and more of our code-style a rule
instead of something we have to take care of during code reviews.

* Ignore safe_xml file

* Don't change safe_lxml_etree

* Fix import unifification going bonkers, I don't blame isort though, this was creepy.

* Fix signin.test_views

* More flake8

* Use style number 4, hanging grid

* django group only contains django now, move above 3rd party group

* Remove pytest-isort for now to avoid isort being imported during tests.

isort has a super bad module that sets the defaultsystemencoding to
utf-8 and breaks our tests that ensure that our settings are *never*
unicode strings. If the default system encoding is set to utf-8 these
tests just work since the bytestring will be implicitly encoded to utf-8
instead of ascii which is the python2 default.

https://github.com/timothycrosley/isort/blob/develop/isort/pie_slice.py#L145
2018-01-08 12:05:14 +01:00
Andrew Williamson 7912c7b08c
prevent @shield.mo and @pioneer.mo guids from being submitted. (#7211) 2018-01-04 12:38:30 +00:00
Andrew Williamson 9eefc17e34
rm all the paypal stats code and remaining old skool payments references (#7011) 2017-11-24 12:54:40 +00:00
Andrew Williamson 4338e45f47
add fxa sqs poller (#6812) 2017-11-16 17:06:44 +00:00
Mathieu Pillard 0af406cbdc
Rename `reviews` to `ratings` internally (#6776)
* Move 'reviews' to 'ratings' to avoid confusion with 'reviewers'
* Change ratings URL names
* Rename Review* models/forms/etc to Rating*
* Rename total_reviews/text_reviews_count/ratings
* Rename activity constants
2017-11-13 18:31:18 +01:00
Mathieu Pillard eea824ffed
Rename and re-organize reviewer groups (#6809)
* Rename and re-organize reviewer groups

- Rename Add-on Reviewers as Reviewers: Legacy, and only give them
  Addons:Review permission.
- Create Unlisted Add-on Reviewers as Reviewers: Unlisted.
- Rename Persona Reviewers as Reviewers: Themes.
- Remove the Senior Personas Reviewers group and SeniorPersonasTools:View
  permission (all Personas reviewer tools are available to all personas
  reviewers).
- Remove the Senior Add-on Reviewers group.
- Create a Reviewers: Content group with the permission Addons:ContentReview.
- Create a Reviewers: Add-ons group with the permission Addons:PostReview.
- Create a Reviewers: Moderators group with the permission Ratings:Moderate.
  That permission replaces the old rules for moderating user reviews.
- Remove the obsolete concept of 'Limited Reviewers'
2017-11-03 15:12:52 +01:00
Hemanth Kumar Veeranki d4d479ac4d Use django default filters instead of babel (#6673)
* Use django default filters instead of babel

Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>

* Modified tests to match current datetime behaviour

Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
2017-11-03 12:48:55 +01:00
Andrew Williamson 2d19463bb6 fix author is public updating (#6763) 2017-10-24 17:37:18 +01:00
Andrew Williamson 0f8fcc64cb attempt to fix UserProfile.is_public not being set with auto-approval (#6755) 2017-10-24 10:37:24 +01:00
Mathieu Pillard d2411fd0b6 Rename editors to reviewers everywhere except in the URLs
URLs to follow in a later commit, it will need redirects etc.
2017-10-23 15:55:32 +02:00
Andrew Williamson bba78ddf2f rm remaining old paypal contributions refs (except stats) (#6743) 2017-10-20 16:19:08 +01:00
Andrew Williamson 615886fccc More paypal code removal (#6733) 2017-10-19 17:01:25 +01:00
Mathieu Pillard 30f25588eb Remove post-review waffle and associated code
Includes removal of:
- Old-style developer agreement
- Previous incarnation of auto-approve with conditions
2017-10-17 16:19:43 +02:00
Christopher Grebs 176383b168 Upgrade to Celery 4 (#6667)
* Update celery, config and dependencies to 4.x

* Remove usage of TaskSet, replace with group(), update `ampq`
* Enable redis on travis for better celery 4.x testing
* Fix lib/celery_tests
* Correct test testing email sending retrying on errors
* Fix celery subtask mocking errors.

* Fix celery broker url env variable

* Integrate watchdog for celery autoreload

* Ensure dependencies are updated for worker and web container.

* Restart all services after the dependency update

* Remove explicit celery loader environment variable.

* Restart all services in web and worker after running 'update_docker'

* Increase sleep time a bit
2017-10-16 11:16:41 +02:00
Mathieu Pillard 43d88b4f55 Revert "Upgrade to Celery 4 (#6625)"
This reverts commit 541688d5f2.

This caused some breakage on dev. We suspect it's because newrelic
hooks into the celery task launching code but does not support
celery 4.x yet.
2017-10-13 00:04:27 +02:00
Christopher Grebs 541688d5f2 Upgrade to Celery 4 (#6625)
* Update celery config to seamlessly upgrade to 4.x

* Update celery initialization for new configs and 4.x

* Update dependencies to celery 4.x

* Fix flake8

* Fix typo

* Remove usage of TaskSet, replace with group(), update `ampq`

* Enable redis on travis for better celery 4.x testing

* Fix more test setting names

* Fix lib/celery_tests

* Correct test testing email sending retrying on errors

* Fix celery subtask mocking errors.

* Fix new line

* Fix celery broker url env variable

* Integrate watchdog for celery autoreload

* Try something weird... ui-tests

* do we need extra hosts?

* more sleep?

* Try logging, try docker run to avoid port collisions

* More debugging

* Cleanup again

* Fix logs?

* Ensure dependencies are updated for worker and web container.

* Remove not functioning log saving for onw

* Restart all services after the dependency update
2017-10-12 21:05:21 +02:00
Andrew Williamson e542aec81b Expose permissions on the account serializer and reorg the code a little (#6450) 2017-09-19 16:31:52 +01:00
Andrew Williamson 628e0afd96 add has_anonymous_username and has_anonymous_display_name to user account api (#6426) 2017-09-15 16:37:01 +01:00
Mathieu Pillard 86c30efcea Add username to user information in API responses 2017-09-11 13:11:03 +02:00
Andrew Williamson 3fd56bfedb Add is_public property to determine profile visibility. 404 on False. (#6219) 2017-08-24 16:31:40 +08:00
Andrew Williamson 929f8135c0 only return profile url in UserSerializer for yourself and addon devs (#6035) 2017-07-31 17:36:24 +01:00
Andrew Williamson 7a58b3bb2c update dev accouncements label to mention about:addons newsletter (#6052) 2017-07-31 10:42:52 +01:00
Andrew Williamson 78277d6792 remove UserProfile ES indexing because it's unused (#6017) 2017-07-26 14:34:24 +01:00
Andrew Williamson c2ed5d3ef9 Add a description to static category to be returned via the API (#5980) 2017-07-24 17:11:15 +01:00
Andrew Williamson abcfbdfe75 prevent non-moco from submitting Mozilla Signed Extensions; (#5868)
* prevent non-moco from submitting Mozilla Signed Extensions; Don't re-sign Mozilla Signed Extensions.
2017-07-13 19:08:22 +01:00
Mathieu Pillard 218c0c75df Fix some django deprecation warnings (#5811)
* Replace SortedDict with OrderedDict

* Replace get_field_by_name() by get_field()

* Consider warnings as errors to catch DeprecationWarnings

* Upgrade pytest django, since it generates a lot of deprecation warnings

* Ignore DeprecationWarning from django-csp

* Replace old option parsing syntax in management commands

* Replace request.REQUEST with request.POST

* Replace custom sql to create indexes by model options

* Replace get_all_field_names() with get_fields()

* don't keep this

* Try removing the create-db, we're having errors at teardown

* Fix commands args parsing

* Re-consider DeprecationWarnings as errors

* Remove usage of Context()

* Fix DeprecationWarning caused by paypal PaypalError self.message

* Fix linter test using exception.message

* Fix mock to prevent passing a callable to a queryset filter

* Remove reference to non-existent fixture

* django.forms.util module has been renamed. Use django.forms.utils instead

* (WIP) Support zh-hant & zh-hans instead of zh-TW and zh-CN, respectively.

* Don't pass callable to queryset

* ignore jwt deprecation warnings

* Don't use TestCase.urls anymore

* test against exception message directly

* Simplify nested context managers

* Restore this usage of Context(), it's still valid

* Restore setup.cfg

* Revert "(WIP) Support zh-hant & zh-hans instead of zh-TW and zh-CN, respectively."

This reverts commit 7d82b59850.

* fix flake8
2017-07-03 19:45:24 +02:00
Christopher Grebs b90bf13922 Merge pull request #5791 from mozilla/1573-implement-django-jinja
Loads of clean-ups along the way.

Fixes #1573

* Moves all helpers modules to templatetags.jinja_helpers - there are a few things in there that aren't jinja related so there'll be a follow-up to split that later
* Update Jinja2 to 2.9.6
* Add django-jinja 2.3.1
* move some jingo-minify helpers to olympia.lib to avoid any jingo imports
* unified |f and |fe helpers into one |format_html helper that always escapes everything unless the input is already |safe

* Move helpers, add requirements, fix imports.
* Give backend a proper name
* Port f and fe filters from jingo
* Make start porting reviews jinja helpers module, make first test pass
* Get a handful more tests working, get rid of get_env, more and more jingo calls.
* Disable extension matching, render .txt templates too, fixes more stats tests
* Fix csv_header template to produce some reasonable and csv parsable
* Set trim_blocks to be compatible with jingo
* Unify |f and |fe into one |format that simplifies escaping rules. Update tests.

I think having one unified |format filter is beneficial, especially
given that our current escaping rules were kinda complicated and allowed
for seriously dangerous combinations even with autoescape activated.

Now everything passed as an argument to |format is explicitly escaped
unless marked as |safe, there's no way around that anymore.

* Naive first version using |format instead of |f and |fe, might need more review.
* Fix format for unicode strings
* Rename |format to |format_html
* Move nl2br_xhtml to amo.jinja_helpers, use it in all our templates.
* Move datetime filter to our code temporarily, fix mocks, fix recursive error
* Move csrf call to django_jinja csrf_token tag, fix addons templatetags
* Fix |class_selected usage, fix render_with to get registered
* Remove hack from zadmin, fix zadmin templatetags
* Fix user delete photo test, don't rely on proper context updates that happen in order.
* Fix more nl2br tests
* Fix detail page escape, django escapes differently than jinja
* Remove context from edit_review_reply_form
* Fix date created format filter usage
* Remove templates setting user, fix can_review
* Fix collect_add_widget to not inherit the global context
* Remove happy unicode client
* Cleanup can_review, add tests
* Fix tests, django use different html character for double quote escaping
* Switch to firefox latest to check ui-tests
* Cleanup and fix do_truncate
* Remove jingo, copy jingo-minify helpers that depend on jingo to our lib for now
* Rename nl2br_xhtml -> nl2br
* Jinja 2.9 compat for reviews truncate filter
* Don't use TEMPLATE_DEBUG
* Set default value for q, happens on index page.
* Fix jinja2 formatting with newstyle gettext
2017-06-30 17:57:31 -07:00
Mathieu Pillard 56555158b8 Make admin separate, removing our crazy base_site.html hack (#5797)
Make admin separate, removing our crazy base_site.html hack
2017-06-29 15:37:35 -07:00
Mathieu Pillard ac2b7974fa Update developer agreement / submission process for post-review (#5754)
Update developer agreement / submission process for post-review

Every developer need to read the new agreement page again, which
now contains review rules & policies as well.
2017-06-27 11:12:42 -07:00