Return absolute URL from narrow.by_conversation_and_time_uri

This commit is contained in:
Mahim Goyal 2017-05-09 14:39:49 +05:30 committed by Tim Abbott
parent 4971b7ff9f
commit 6fe0728afa
1 changed files with 10 additions and 3 deletions

View File

@ -564,13 +564,20 @@ exports.by_near_uri = function (message_id) {
return "#narrow/near/" + hash_util.encodeHashComponent(message_id);
};
exports.by_conversation_and_time_uri = function (message) {
exports.by_conversation_and_time_uri = function (message, is_absolute_url) {
var absolute_url = "";
if (is_absolute_url) {
absolute_url = window.location .protocol + "//" +
window.location.host + "/" + window.location.pathname.split('/')[1];
}
if (message.type === "stream") {
return "#narrow/stream/" + hash_util.encodeHashComponent(message.stream) +
return absolute_url + "#narrow/stream/" +
hash_util.encodeHashComponent(message.stream) +
"/subject/" + hash_util.encodeHashComponent(message.subject) +
"/near/" + hash_util.encodeHashComponent(message.id);
}
return "#narrow/pm-with/" + hash_util.encodeHashComponent(message.reply_to) +
return absolute_url + "#narrow/pm-with/" +
hash_util.encodeHashComponent(message.reply_to) +
"/near/" + hash_util.encodeHashComponent(message.id);
};