mirror of https://github.com/zulip/zulip.git
models: Rename MutedTopic to UserTopic.
Part of #19272 We still keep refering to this model with "MutedTopic" to reduce the diff size of this commit. The alias will be removed in the next commit. This commit skips on renaming the `date_muted` field to something more general. That will be done in further commits, along with the code and API changes.
This commit is contained in:
parent
8532e22fcd
commit
798defc046
|
@ -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",
|
||||
),
|
||||
]
|
|
@ -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"<MutedTopic: ({self.user_profile.email}, {self.stream.name}, {self.topic_name}, {self.date_muted})>"
|
||||
return f"<UserTopic: ({self.user_profile.email}, {self.stream.name}, {self.topic_name}, {self.date_muted})>"
|
||||
|
||||
|
||||
MutedTopic = UserTopic
|
||||
|
||||
|
||||
class MutedUser(models.Model):
|
||||
|
|
Loading…
Reference in New Issue