mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Don't save narrow operators to the URL fragment if that's where they came from
In Firefox, prevents e.g. a slash in a stream name, which we wanted to store as %2F, from converting back to a literal slash. There is some appeal to normalizing the URL fragment after parsing, but in general this way seems better. It may decrease page load time on narrowed views. Doesn't yet fix #826; the URL is correct but the narrow is still wrong. (imported from commit 32e3fa9e968139863f34b9698f1c8b39d06f0c14)
This commit is contained in:
@@ -45,7 +45,10 @@ function parse_narrow(hash) {
|
|||||||
} else {
|
} else {
|
||||||
new_selection = initial_pointer;
|
new_selection = initial_pointer;
|
||||||
}
|
}
|
||||||
narrow.activate(operators, {then_select_id: new_selection});
|
narrow.activate(operators, {
|
||||||
|
then_select_id: new_selection,
|
||||||
|
change_hash: false // already set
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if this function performed a narrow
|
// Returns true if this function performed a narrow
|
||||||
|
|||||||
@@ -271,7 +271,8 @@ function build_filter(operators_mixed_case) {
|
|||||||
exports.activate = function (operators, opts) {
|
exports.activate = function (operators, opts) {
|
||||||
opts = $.extend({}, {
|
opts = $.extend({}, {
|
||||||
then_select_id: home_msg_list.selected_id(),
|
then_select_id: home_msg_list.selected_id(),
|
||||||
select_first_unread: false
|
select_first_unread: false,
|
||||||
|
change_hash: true
|
||||||
}, opts);
|
}, opts);
|
||||||
|
|
||||||
// Unfade the home view before we switch tables.
|
// Unfade the home view before we switch tables.
|
||||||
@@ -350,8 +351,13 @@ exports.activate = function (operators, opts) {
|
|||||||
}
|
}
|
||||||
search.update_highlighting(extract_search_terms(operators));
|
search.update_highlighting(extract_search_terms(operators));
|
||||||
|
|
||||||
// Put the narrow operators in the URL fragment and search bar
|
// Put the narrow operators in the URL fragment.
|
||||||
|
// Disabled when the URL fragment was the source
|
||||||
|
// of this narrow.
|
||||||
|
if (opts.change_hash)
|
||||||
hashchange.save_narrow(operators);
|
hashchange.save_narrow(operators);
|
||||||
|
|
||||||
|
// Put the narrow operators in the search bar.
|
||||||
$('#search_query').val(unparse(operators));
|
$('#search_query').val(unparse(operators));
|
||||||
search.update_button_visibility();
|
search.update_button_visibility();
|
||||||
compose.update_recipient_on_narrow();
|
compose.update_recipient_on_narrow();
|
||||||
|
|||||||
Reference in New Issue
Block a user