populate_db: Add links to stream descriptions.

Added a 10 percent chance to append a URL to both the default and
extra stream descriptions.
This commit is contained in:
Arun Sankar 2021-04-03 23:28:23 +05:30
parent 53ab137710
commit a848afd078
1 changed files with 20 additions and 0 deletions

View File

@ -809,6 +809,18 @@ class Command(BaseCommand):
"アニメ",
]
stream_description_urls = [
("Read the docs", "https://zulip.readthedocs.io/en/latest/"),
("Browser", "https://duckduckgo.com/"),
("Open Source", "https://opensource.org/"),
("Zulip Repo", "https://github.com/zulip/zulip"),
("Programmer", "https://en.wikipedia.org/wiki/Programmer"),
("CERN", "https://home.cern/"),
("Bicycling", "https://www.bicycling.com/training/"),
("Nvidia", "https://www.nvidia.com/"),
("Richard Feynman", "https://www.britannica.com/biography/Richard-Feynman"),
]
# Add stream names and stream descriptions
for i in range(options["extra_streams"]):
extra_stream_name = random.choice(extra_stream_names) + " " + str(i)
@ -821,6 +833,14 @@ class Command(BaseCommand):
"description": "Auto-generated extra stream.",
}
for stream_name in zulip_stream_dict.keys():
# Add Urls to stream descriptions.
if random.random() <= 0.10:
hyperlink, url = random.choice(stream_description_urls)
zulip_stream_dict[stream_name]["description"] += str(
" [{0}]({1})".format(hyperlink, url)
)
bulk_create_streams(zulip_realm, zulip_stream_dict)
# Now that we've created the notifications stream, configure it properly.
zulip_realm.notifications_stream = get_stream("announce", zulip_realm)