mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
Remove obsolete management command for mit.edufullname transition.
(imported from commit aed2a2d7bfedd98e2406bb18bf54f953a5ae7ef3)
This commit is contained in:
parent
11b92534e8
commit
ddbfe31449
@ -1,29 +0,0 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from optparse import make_option
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from zerver.models import UserProfile
|
||||
from zerver.lib.actions import compute_mit_user_fullname
|
||||
|
||||
# Helper to be used with manage.py shell to fix bad names on prod.
|
||||
def update_mit_fullnames(change=False):
|
||||
for u in UserProfile.objects.select_related().all():
|
||||
if (u.is_active or u.realm.domain != "mit.edu"):
|
||||
# Don't change fullnames for non-MIT users or users who
|
||||
# actually have an account (is_active) and thus have
|
||||
# presumably set their fullname how they like it.
|
||||
continue
|
||||
computed_name = compute_mit_user_fullname(u.email)
|
||||
if u.full_name != computed_name:
|
||||
print "%s: %s => %s" % (u.email, u.full_name, computed_name)
|
||||
if change:
|
||||
u.full_name = computed_name
|
||||
u.save(update_fields=["full_name"])
|
||||
|
||||
class Command(BaseCommand):
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option('--dry-run', '-n', dest='dry_run', default=False, action='store_true'),)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
update_mit_fullnames(change=not options['dry_run'])
|
||||
Loading…
Reference in New Issue
Block a user