mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	management: Rename command reactivate_stream -> unarchive_stream.
This commit is contained in:
		@@ -165,7 +165,7 @@ def deactivated_streams_by_old_name(realm: Realm, stream_name: str) -> QuerySet[
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@transaction.atomic(savepoint=False)
 | 
			
		||||
def do_reactivate_stream(
 | 
			
		||||
def do_unarchive_stream(
 | 
			
		||||
    stream: Stream, new_name: str, *, acting_user: Optional[UserProfile]
 | 
			
		||||
) -> None:
 | 
			
		||||
    realm = stream.realm
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ from typing import Any, Optional
 | 
			
		||||
 | 
			
		||||
from django.core.management.base import CommandError
 | 
			
		||||
 | 
			
		||||
from zerver.actions.streams import deactivated_streams_by_old_name, do_reactivate_stream
 | 
			
		||||
from zerver.actions.streams import deactivated_streams_by_old_name, do_unarchive_stream
 | 
			
		||||
from zerver.lib.management import ZulipBaseCommand
 | 
			
		||||
from zerver.models import RealmAuditLog, Stream
 | 
			
		||||
 | 
			
		||||
@@ -88,4 +88,4 @@ class Command(ZulipBaseCommand):
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        assert stream is not None
 | 
			
		||||
        do_reactivate_stream(stream, new_name, acting_user=None)
 | 
			
		||||
        do_unarchive_stream(stream, new_name, acting_user=None)
 | 
			
		||||
@@ -33,7 +33,7 @@ from zerver.actions.streams import (
 | 
			
		||||
    do_change_stream_group_based_setting,
 | 
			
		||||
    do_change_stream_post_policy,
 | 
			
		||||
    do_deactivate_stream,
 | 
			
		||||
    do_reactivate_stream,
 | 
			
		||||
    do_unarchive_stream,
 | 
			
		||||
)
 | 
			
		||||
from zerver.actions.user_groups import add_subgroups_to_user_group, check_add_user_group
 | 
			
		||||
from zerver.actions.users import do_change_user_role, do_deactivate_user
 | 
			
		||||
@@ -1351,19 +1351,19 @@ class StreamAdminTest(ZulipTestCase):
 | 
			
		||||
        old_style.save()
 | 
			
		||||
        self.assertEqual(set(deactivated_streams_by_old_name(realm, "old_style")), {old_style})
 | 
			
		||||
 | 
			
		||||
    def test_reactivate_stream_active_stream(self) -> None:
 | 
			
		||||
    def test_unarchive_stream_active_stream(self) -> None:
 | 
			
		||||
        stream = self.make_stream("new_stream")
 | 
			
		||||
        with self.assertRaisesRegex(JsonableError, "Stream is not currently deactivated"):
 | 
			
		||||
            do_reactivate_stream(stream, new_name="new_stream", acting_user=None)
 | 
			
		||||
            do_unarchive_stream(stream, new_name="new_stream", acting_user=None)
 | 
			
		||||
 | 
			
		||||
    def test_reactivate_stream_existing_name(self) -> None:
 | 
			
		||||
    def test_unarchive_stream_existing_name(self) -> None:
 | 
			
		||||
        stream = self.make_stream("new_stream")
 | 
			
		||||
        self.make_stream("existing")
 | 
			
		||||
        do_deactivate_stream(stream, acting_user=None)
 | 
			
		||||
        with self.assertRaisesRegex(JsonableError, "Stream named existing already exists"):
 | 
			
		||||
            do_reactivate_stream(stream, new_name="existing", acting_user=None)
 | 
			
		||||
            do_unarchive_stream(stream, new_name="existing", acting_user=None)
 | 
			
		||||
 | 
			
		||||
    def test_reactivate_stream(self) -> None:
 | 
			
		||||
    def test_unarchive_stream(self) -> None:
 | 
			
		||||
        desdemona = self.example_user("desdemona")
 | 
			
		||||
        iago = self.example_user("iago")
 | 
			
		||||
        hamlet = self.example_user("hamlet")
 | 
			
		||||
@@ -1374,7 +1374,7 @@ class StreamAdminTest(ZulipTestCase):
 | 
			
		||||
        self.subscribe(cordelia, stream.name)
 | 
			
		||||
        do_deactivate_stream(stream, acting_user=None)
 | 
			
		||||
        with self.capture_send_event_calls(expected_num_events=4) as events:
 | 
			
		||||
            do_reactivate_stream(stream, new_name="new_stream", acting_user=None)
 | 
			
		||||
            do_unarchive_stream(stream, new_name="new_stream", acting_user=None)
 | 
			
		||||
 | 
			
		||||
        # Tell all admins and owners that the stream exists
 | 
			
		||||
        self.assertEqual(events[0]["event"]["op"], "create")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user