mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 08:33:43 +00:00
analytics: Create a RealmAuditLog entry when subscribing test users.
This commit is contained in:
committed by
Tim Abbott
parent
ca2ca030d2
commit
505eec4bac
@@ -24,7 +24,16 @@ from zerver.lib.storage import static_path
|
|||||||
from zerver.lib.stream_color import STREAM_ASSIGNMENT_COLORS
|
from zerver.lib.stream_color import STREAM_ASSIGNMENT_COLORS
|
||||||
from zerver.lib.timestamp import floor_to_day
|
from zerver.lib.timestamp import floor_to_day
|
||||||
from zerver.lib.upload import upload_message_attachment_from_request
|
from zerver.lib.upload import upload_message_attachment_from_request
|
||||||
from zerver.models import Client, Realm, Recipient, Stream, Subscription, UserGroup, UserProfile
|
from zerver.models import (
|
||||||
|
Client,
|
||||||
|
Realm,
|
||||||
|
RealmAuditLog,
|
||||||
|
Recipient,
|
||||||
|
Stream,
|
||||||
|
Subscription,
|
||||||
|
UserGroup,
|
||||||
|
UserProfile,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@@ -116,16 +125,20 @@ class Command(BaseCommand):
|
|||||||
stream.save(update_fields=["recipient"])
|
stream.save(update_fields=["recipient"])
|
||||||
|
|
||||||
# Subscribe shylock to the stream to avoid invariant failures.
|
# Subscribe shylock to the stream to avoid invariant failures.
|
||||||
# TODO: This should use subscribe_users_to_streams from populate_db.
|
Subscription.objects.create(
|
||||||
subs = [
|
recipient=recipient,
|
||||||
Subscription(
|
user_profile=shylock,
|
||||||
recipient=recipient,
|
is_user_active=shylock.is_active,
|
||||||
user_profile=shylock,
|
color=STREAM_ASSIGNMENT_COLORS[0],
|
||||||
is_user_active=shylock.is_active,
|
)
|
||||||
color=STREAM_ASSIGNMENT_COLORS[0],
|
RealmAuditLog.objects.create(
|
||||||
),
|
realm=realm,
|
||||||
]
|
modified_user=shylock,
|
||||||
Subscription.objects.bulk_create(subs)
|
modified_stream=stream,
|
||||||
|
event_last_message_id=0,
|
||||||
|
event_type=RealmAuditLog.SUBSCRIPTION_CREATED,
|
||||||
|
event_time=installation_time,
|
||||||
|
)
|
||||||
|
|
||||||
# Create an attachment in the database for set_storage_space_used_statistic.
|
# Create an attachment in the database for set_storage_space_used_statistic.
|
||||||
IMAGE_FILE_PATH = static_path("images/test-images/checkbox.png")
|
IMAGE_FILE_PATH = static_path("images/test-images/checkbox.png")
|
||||||
|
|||||||
Reference in New Issue
Block a user