models: Update can_remove_subscribers_group field to not be null.

This commit udpates can_remove_subscribers_group to be not null.
We already added a migration to set the value of this field for
existing streams and also added a commit to set this field to
admins system group for now while creating streams.
This commit is contained in:
Sahil Batra
2022-07-22 23:08:53 +05:30
committed by Tim Abbott
parent c9c230c2da
commit 86c2f6881e
2 changed files with 23 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
# Generated by Django 4.0.6 on 2022-07-22 14:47
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0409_set_default_for_can_remove_subscribers_group"),
]
operations = [
migrations.AlterField(
model_name="stream",
name="can_remove_subscribers_group",
field=models.ForeignKey(
on_delete=django.db.models.deletion.RESTRICT, to="zerver.usergroup"
),
),
]

View File

@@ -2511,8 +2511,8 @@ class Stream(models.Model):
# deleting a user group in case it is referenced by this settig.
# We are not using PROTECT since we want to allow deletion of user groups
# when realm itself is deleted.
can_remove_subscribers_group: Optional[UserGroup] = models.ForeignKey(
UserGroup, null=True, on_delete=models.RESTRICT
can_remove_subscribers_group: UserGroup = models.ForeignKey(
UserGroup, on_delete=models.RESTRICT
)
# The very first message ID in the stream. Used to help clients