Closed Bug 1308222 Opened 8 years ago Closed 8 years ago

Move pages fails if multiple profiles share the admin's email

Categories

(developer.mozilla.org Graveyard :: Wiki pages, defect)

All
Other
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwhitlock, Assigned: safwan)

References

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

What did you do?
================
Test moving a page on the staging server

What happened?
==============
A 500 Internal Server Error is returned, the page is unmoved

What should have happened?
==========================
The page move should have happened, and an email should be sent to the user that made the request, as identified by the user ID.

Is there anything else we should know?
======================================
We currently allow duplicate accounts with the same email address. It appears to be to support legacy accounts - almost 6000 have an empty string for an email, and the newest of these is from 2012. It is a bad assumption that an email is a unique identifier for a user.

The traceback is recorded in Sentry as:

https://sentry.prod.mozaws.net/operations/mdn-stage/issues/355109/

The traceback:

MultipleObjectsReturned: get() returned more than one User -- it returned 3!
  File "celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "newrelic/hooks/application_celery.py", line 66, in wrapper
    return wrapped(*args, **kwargs)
  File "celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "kuma/wiki/tasks.py", line 148, in move_page
    user = User.objects.get(email=email)
  File "django/db/models/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 338, in get
    (self.model._meta.object_name, num)

This does not appear to have happened in production.
Moving importance to trivial, because it hasn't happened in production.  "move page" code is bad and needs to be re-written.
Severity: normal → trivial
Blocks: 971681
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/e46f1e944bb6d7aa3918dfe3ef055a90904ca4b1
[Bug 1308222] move page fails with multiple profile same email

https://github.com/mozilla/kuma/commit/662ad8f60e4d1e456ebc90890fafa24e4e7738d4
Merge pull request #4042 from safwanrahman/move_page

[Bug 1308222] move page fails with multiple profile same email
Assignee: nobody → safwan.rahman15
Deployed into production
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.