topics: Change topic links of left sidebar to use new permalinks.

This commit updates the topic links obtained from clicking
the topics in the left sidebar, recent view and inbox, and
those obtained from "Copy link to topic" to use the new
topic permalinks.

Fixes part of #21505.
This commit is contained in:
roanster007
2024-06-01 19:12:54 +05:30
committed by Tim Abbott
parent e67786154a
commit 41f30e1052
12 changed files with 79 additions and 10 deletions

View File

@@ -47,6 +47,13 @@ run_test("test by_stream_url", () => {
run_test("test by_stream_topic_url", () => {
const maybe_get_stream_name = () => "a test stream";
const result = internal_url.by_stream_topic_url(123, "test topic", maybe_get_stream_name);
// Test stream_topic_url is a traditional topic link when the
// message_id to be encoded is undefined.
let result = internal_url.by_stream_topic_url(123, "test topic", maybe_get_stream_name);
assert.equal(result, "#narrow/channel/123-a-test-stream/topic/test.20topic");
// Test stream_topic_url is a topic permaling when the
// message_id to be encoded is not undefined.
result = internal_url.by_stream_topic_url(123, "test topic", maybe_get_stream_name, 12);
assert.equal(result, "#narrow/channel/123-a-test-stream/topic/test.20topic/with/12");
});