subject -> topic: Fix hash_util.js.

This includes using a more modern URL for topic links.
(We already supported "../topic/..." urls.)
This commit is contained in:
Steve Howell 2018-12-22 22:04:23 +00:00 committed by Tim Abbott
parent 95e213df87
commit 56a893cd94
3 changed files with 6 additions and 5 deletions

View File

@ -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',

View File

@ -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;

View File

@ -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;
}