From 53bbaac0eb515febb74a7a8f97dd9483df9a8568 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sat, 9 Oct 2021 22:36:14 +0300 Subject: Implement voice mute + migration from voice mute -> voice ban --- pydis_site/apps/api/migrations/0074_voice_mute.py | 36 +++++++++++++++++++++++ pydis_site/apps/api/models/bot/infraction.py | 3 +- pydis_site/apps/api/serializers.py | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 pydis_site/apps/api/migrations/0074_voice_mute.py diff --git a/pydis_site/apps/api/migrations/0074_voice_mute.py b/pydis_site/apps/api/migrations/0074_voice_mute.py new file mode 100644 index 00000000..937557bc --- /dev/null +++ b/pydis_site/apps/api/migrations/0074_voice_mute.py @@ -0,0 +1,36 @@ +# Generated by Django 3.0.14 on 2021-10-09 18:52 +from django.apps.registry import Apps +from django.db import migrations, models +from django.db.backends.base.schema import BaseDatabaseSchemaEditor + + +def migrate_infractions(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: + Infraction = apps.get_model("api", "Infraction") + + for infraction in Infraction.objects.filter(type="voice_ban"): + infraction.type = "voice_mute" + infraction.save() + + +def unmigrate_infractions(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: + Infraction = apps.get_model("api", "Infraction") + + for infraction in Infraction.objects.filter(type="voice_mute"): + infraction.type = "voice_ban" + infraction.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0073_otn_allow_GT_and_LT'), + ] + + operations = [ + migrations.AlterField( + model_name='infraction', + name='type', + field=models.CharField(choices=[('note', 'Note'), ('warning', 'Warning'), ('watch', 'Watch'), ('mute', 'Mute'), ('kick', 'Kick'), ('ban', 'Ban'), ('superstar', 'Superstar'), ('voice_ban', 'Voice Ban'), ('voice_mute', 'Voice Mute')], help_text='The type of the infraction.', max_length=10), + ), + migrations.RunPython(migrate_infractions, unmigrate_infractions) + ] diff --git a/pydis_site/apps/api/models/bot/infraction.py b/pydis_site/apps/api/models/bot/infraction.py index 60c1e8dd..63745490 100644 --- a/pydis_site/apps/api/models/bot/infraction.py +++ b/pydis_site/apps/api/models/bot/infraction.py @@ -17,6 +17,7 @@ class Infraction(ModelReprMixin, models.Model): ("ban", "Ban"), ("superstar", "Superstar"), ("voice_ban", "Voice Ban"), + ("voice_mute", "Voice Mute"), ) inserted_at = models.DateTimeField( default=timezone.now, @@ -45,7 +46,7 @@ class Infraction(ModelReprMixin, models.Model): help_text="The user which applied the infraction." ) type = models.CharField( - max_length=9, + max_length=10, choices=TYPE_CHOICES, help_text="The type of the infraction." ) diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index f47bedca..8484e561 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -168,7 +168,7 @@ class InfractionSerializer(ModelSerializer): raise ValidationError({'expires_at': [f'{infr_type} infractions cannot expire.']}) hidden = attrs.get('hidden') - if hidden and infr_type in ('superstar', 'warning', 'voice_ban'): + if hidden and infr_type in ('superstar', 'warning', 'voice_ban', 'voice_mute'): raise ValidationError({'hidden': [f'{infr_type} infractions cannot be hidden.']}) if not hidden and infr_type in ('note', ): -- cgit v1.2.3 From cacbece7686f1d98671eecb4f9e82fb5724d3445 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Sun, 23 Jan 2022 14:48:25 -0500 Subject: Prevent page title from overlapping dropdown button. On clients with a small viewport width, the content title of pages overlap the "Sub-Articles" dropdown button due to having the same z-index, causing the element last positioned in the HTML to show up on top. Fixes #643. --- pydis_site/templates/content/dropdown.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/content/dropdown.html b/pydis_site/templates/content/dropdown.html index d81e29dc..13c89c68 100644 --- a/pydis_site/templates/content/dropdown.html +++ b/pydis_site/templates/content/dropdown.html @@ -1,4 +1,4 @@ -