From 56a893cd94ae1705501518ca4570e81a96050692 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sat, 22 Dec 2018 22:04:23 +0000 Subject: [PATCH] subject -> topic: Fix hash_util.js. This includes using a more modern URL for topic links. (We already supported "../topic/..." urls.) --- frontend_tests/node_tests/hash_util.js | 3 ++- frontend_tests/node_tests/topic_list.js | 2 +- static/js/hash_util.js | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend_tests/node_tests/hash_util.js b/frontend_tests/node_tests/hash_util.js index 98f50b6d7e..1fdd5964c0 100644 --- a/frontend_tests/node_tests/hash_util.js +++ b/frontend_tests/node_tests/hash_util.js @@ -1,6 +1,7 @@ zrequire('hash_util'); zrequire('stream_data'); zrequire('people'); +zrequire('util'); var _window = { location: { @@ -137,7 +138,7 @@ run_test('test_by_conversation_and_time_uri', () => { }; assert.equal(hash_util.by_conversation_and_time_uri(message), - 'https://example.com/#narrow/stream/99-frontend/subject/testing/near/42'); + 'https://example.com/#narrow/stream/99-frontend/topic/testing/near/42'); message = { type: 'private', diff --git a/frontend_tests/node_tests/topic_list.js b/frontend_tests/node_tests/topic_list.js index 701b5ee4c7..3f861033f3 100644 --- a/frontend_tests/node_tests/topic_list.js +++ b/frontend_tests/node_tests/topic_list.js @@ -49,7 +49,7 @@ run_test('topic_list_build_widget', () => { unread: 3, is_zero: false, is_muted: false, - url: '#narrow/stream/555-devel/subject/coding', + url: '#narrow/stream/555-devel/topic/coding', }; assert.deepEqual(info, expected); rendered = true; diff --git a/static/js/hash_util.js b/static/js/hash_util.js index 46314f9e2f..ff25a2a333 100644 --- a/static/js/hash_util.js +++ b/static/js/hash_util.js @@ -84,9 +84,9 @@ exports.by_stream_uri = function (stream_id) { return "#narrow/stream/" + exports.encode_stream_id(stream_id); }; -exports.by_stream_topic_uri = function (stream_id, subject) { +exports.by_stream_topic_uri = function (stream_id, topic) { return "#narrow/stream/" + exports.encode_stream_id(stream_id) + - "/subject/" + exports.encodeHashComponent(subject); + "/topic/" + exports.encodeHashComponent(topic); }; // Encodes an operator list into the @@ -140,7 +140,7 @@ exports.by_conversation_and_time_uri = function (message) { if (message.type === "stream") { return absolute_url + - exports.by_stream_topic_uri(message.stream_id, message.subject) + + exports.by_stream_topic_uri(message.stream_id, util.get_message_topic(message)) + suffix; }