streams: Render and store the stream description from the backend.

This commit does the following three things:
    1. Update stream model to accomodate rendered description.
    2. Render and save the stream rendered description on update.
    3. Render and save stream descriptions on creation.

Further, the stream's rendered description is also sent whenever the
stream's description is being sent.

This is preparatory work for eliminating the use of the
non-authoritative marked.js markdown parser for stream descriptions.
This commit is contained in:
Hemanth V. Alluri
2019-01-11 18:18:22 +05:30
committed by Tim Abbott
parent 022c8beaf5
commit 73d26c8b28
10 changed files with 70 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ from zerver.lib.initial_password import initial_password
from zerver.models import Realm, Stream, UserProfile, Huddle, \
Subscription, Recipient, Client, RealmAuditLog, get_huddle_hash
from zerver.lib.create_user import create_user_profile
from zerver.lib.bugdown import convert as bugdown_convert
def bulk_create_users(realm: Realm,
users_raw: Set[Tuple[str, str, str, bool]],
@@ -75,6 +76,7 @@ def bulk_create_streams(realm: Realm,
realm=realm,
name=name,
description=options["description"],
rendered_description=bugdown_convert(options["description"]),
invite_only=options.get("invite_only", False),
is_announcement_only=options.get("is_announcement_only", False),
history_public_to_subscribers=options["history_public_to_subscribers"],