mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 09:58:06 +00:00
narrow: Fix incorrect values for use_first_unread_anchor.
Apparently, we were incorrectly passing through something related to opts.use_initial_narrow_pointer as the value for `use_first_anchor`. If you read the logic in narrow.js carefully, use_initial_narrow_pointer was unconditionally false. The correct value for this attribute is when we're trying to narrow to the first unread message in a given context. There are two things to check: * then_select_id is -1; i.e. we don't have a specific message ID we're trying to narrow around. * select_first_unread is True, i.e. we're trying to narrow to the first unread message. A bit more work should allow us to get rid of the second condition, but I'm not quite confident enough to do that yet.
This commit is contained in:
@@ -165,7 +165,7 @@ function stub_message_list() {
|
|||||||
assert.deepEqual(opts, {
|
assert.deepEqual(opts, {
|
||||||
cont: opts.cont,
|
cont: opts.cont,
|
||||||
then_select_id: selected_id,
|
then_select_id: selected_id,
|
||||||
use_initial_narrow_pointer: false,
|
use_first_unread_anchor: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ exports.load_messages_for_narrow = function (opts) {
|
|||||||
num_before: consts.narrow_before,
|
num_before: consts.narrow_before,
|
||||||
num_after: consts.narrow_after,
|
num_after: consts.narrow_after,
|
||||||
msg_list: msg_list,
|
msg_list: msg_list,
|
||||||
use_first_unread_anchor: opts.use_initial_narrow_pointer,
|
use_first_unread_anchor: opts.use_first_unread_anchor,
|
||||||
cont: function (data) {
|
cont: function (data) {
|
||||||
msg_list.fetch_status.finish_initial_narrow({
|
msg_list.fetch_status.finish_initial_narrow({
|
||||||
found_oldest: data.found_oldest,
|
found_oldest: data.found_oldest,
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ exports.activate = function (raw_operators, opts) {
|
|||||||
var defer_selecting_closest = message_list.narrowed.empty();
|
var defer_selecting_closest = message_list.narrowed.empty();
|
||||||
message_fetch.load_messages_for_narrow({
|
message_fetch.load_messages_for_narrow({
|
||||||
then_select_id: then_select_id,
|
then_select_id: then_select_id,
|
||||||
use_initial_narrow_pointer: opts.use_initial_narrow_pointer,
|
use_first_unread_anchor: opts.select_first_unread && then_select_id === -1,
|
||||||
cont: function () {
|
cont: function () {
|
||||||
if (defer_selecting_closest) {
|
if (defer_selecting_closest) {
|
||||||
maybe_select_closest();
|
maybe_select_closest();
|
||||||
|
|||||||
Reference in New Issue
Block a user