diff --git a/zerver/migrations/0340_rename_mutedtopic_to_usertopic.py b/zerver/migrations/0340_rename_mutedtopic_to_usertopic.py new file mode 100644 index 0000000000..891207e3e6 --- /dev/null +++ b/zerver/migrations/0340_rename_mutedtopic_to_usertopic.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.5 on 2021-07-23 13:15 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("zerver", "0339_remove_realm_add_emoji_by_admins_only"), + ] + + operations = [ + migrations.RenameModel( + old_name="MutedTopic", + new_name="UserTopic", + ), + migrations.AlterModelTable( + name="usertopic", + table="zerver_mutedtopic", + ), + ] diff --git a/zerver/models.py b/zerver/models.py index c8c340b58d..c4ed3a2aac 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -2128,7 +2128,7 @@ post_save.connect(flush_stream, sender=Stream) post_delete.connect(flush_stream, sender=Stream) -class MutedTopic(models.Model): +class UserTopic(models.Model): id: int = models.AutoField(auto_created=True, primary_key=True, verbose_name="ID") user_profile: UserProfile = models.ForeignKey(UserProfile, on_delete=CASCADE) stream: Stream = models.ForeignKey(Stream, on_delete=CASCADE) @@ -2144,8 +2144,16 @@ class MutedTopic(models.Model): class Meta: unique_together = ("user_profile", "stream", "topic_name") + # This model was originally called "MutedTopic". We + # generalized it to "UserTopic", but have not yet done the + # database migration to rename the table and indexes. + db_table = "zerver_mutedtopic" + def __str__(self) -> str: - return f"" + return f"" + + +MutedTopic = UserTopic class MutedUser(models.Model):