mirror of https://github.com/zulip/zulip.git
streams: Fix malformed stream name slugs.
The stream_data.id_to_slug and stream_data.name_to_slug functions mistakenly used Javascript's String.replace method, this commit changes it to use String.replaceAll, the result being slugs generated from streams with names greater than 2 words are now properly formatted.
This commit is contained in:
parent
8ed7dcf4c0
commit
980fd2f976
|
@ -556,12 +556,12 @@ test("marked", () => {
|
|||
{
|
||||
input: "#**& & &**",
|
||||
expected:
|
||||
'<p><a class="stream" data-stream-id="5" href="/#narrow/stream/5-.26-.26.20.26amp.3B">#& & &amp;</a></p>',
|
||||
'<p><a class="stream" data-stream-id="5" href="/#narrow/stream/5-.26-.26-.26amp.3B">#& & &amp;</a></p>',
|
||||
},
|
||||
{
|
||||
input: "#**& & &amp;>& & &amp;**",
|
||||
expected:
|
||||
'<p><a class="stream-topic" data-stream-id="5" href="/#narrow/stream/5-.26-.26.20.26amp.3B/topic/.26.20.26.20.26amp.3B">#& & &amp; > & & &amp;</a></p>',
|
||||
'<p><a class="stream-topic" data-stream-id="5" href="/#narrow/stream/5-.26-.26-.26amp.3B/topic/.26.20.26.20.26amp.3B">#& & &amp; > & & &amp;</a></p>',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ export function id_to_slug(stream_id) {
|
|||
|
||||
// The name part of the URL doesn't really matter, so we try to
|
||||
// make it pretty.
|
||||
name = name.replace(" ", "-");
|
||||
name = name.replaceAll(" ", "-");
|
||||
|
||||
return stream_id + "-" + name;
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ export function name_to_slug(name) {
|
|||
|
||||
// The name part of the URL doesn't really matter, so we try to
|
||||
// make it pretty.
|
||||
name = name.replace(" ", "-");
|
||||
name = name.replaceAll(" ", "-");
|
||||
|
||||
return stream_id + "-" + name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue