populate_db: Add Emojis to stream descriptions.

Added a 20 percent chance to add a random emoji to Stream description
on populate_db.

One out of the Two types of emojis will be added to the descriptions,
one being zulip supported ie " : eyes : " and the other being general
emoji ie "😎" (non BMP).

Replaced some emojis in `DEFAULT_EMOJIS` as previous emojis listed in
it were not rendered on the front-end.

Fixes part of #14991
This commit is contained in:
Arun Sankar 2021-04-04 08:59:43 +05:30
parent 6f020c0c7d
commit d1bc8135d6
1 changed files with 20 additions and 4 deletions

View File

@ -79,10 +79,10 @@ DEFAULT_EMOJIS = [
("+1", "1f44d"),
("smiley", "1f603"),
("eyes", "1f440"),
("crying_cat_face", "1f63f"),
("arrow_up", "2b06"),
("confetti_ball", "1f38a"),
("hundred_points", "1f4af"),
("money", "1f4b0"),
("high_five", "1f590"),
("construction_worker", "1f477"),
("ok_signal", "1f646"),
]
@ -854,6 +854,22 @@ class Command(BaseCommand):
random_word, str(markdown + random_word + markdown[::-1])
)
# Add Emojis to the stream descriptions
if random.random() <= 0.20:
if random.random() <= 50:
# Add Emojis supported by zulip.
emoji_name, emoji_code = random.choice(DEFAULT_EMOJIS)
zulip_stream_dict[stream_name]["description"] += str(
" :{}: ".format(emoji_name)
)
else:
# Add general Emojis.
zulip_stream_dict[stream_name]["description"] += random.choice(
raw_emojis
)
# Add Urls to stream descriptions.
if random.random() <= 0.10:
hyperlink, url = random.choice(stream_description_urls)