refactor: Extract stream_data.clean_up_description().

We use this in the few places where update_calculated_fields()
could plausibly be dealing with a new rendered description.
This commit is contained in:
Steve Howell
2021-04-04 17:07:25 +00:00
committed by Tim Abbott
parent 99b177dc7d
commit 5624ed2afe
4 changed files with 10 additions and 5 deletions

View File

@@ -631,6 +631,12 @@ export function create_streams(streams) {
}
}
export function clean_up_description(sub) {
if (sub.rendered_description !== undefined) {
sub.rendered_description = sub.rendered_description.replace("<p>", "").replace("</p>", "");
}
}
export function create_sub_from_server_data(attrs) {
if (!attrs.stream_id) {
// fail fast
@@ -680,6 +686,7 @@ export function create_sub_from_server_data(attrs) {
// TODO: Let stream settings code add these fields.
stream_settings_data.update_calculated_fields(sub);
clean_up_description(sub);
stream_info.set(sub.name, sub);
subs_by_stream_id.set(sub.stream_id, sub);