mirror of https://github.com/zulip/zulip.git
home.py: move initial_pointer as pointer to register_ret.
This is the last of the fields in page_params that could come from register_ret but wasn't doing so.
This commit is contained in:
parent
d3e7e6542a
commit
78f2df5649
|
@ -138,7 +138,7 @@ exports.load_more_messages = function load_more_messages(msg_list) {
|
|||
ui.show_loading_more_messages_indicator();
|
||||
load_more_enabled = false;
|
||||
if (msg_list.first() === undefined) {
|
||||
oldest_message_id = page_params.initial_pointer;
|
||||
oldest_message_id = page_params.pointer;
|
||||
} else {
|
||||
oldest_message_id = msg_list.first().id;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ util.execute_early(function () {
|
|||
// We fall back to the closest selected id, as the user may have removed
|
||||
// a stream from the home before already
|
||||
if (home_msg_list.selected_id() === -1 && !home_msg_list.empty()) {
|
||||
home_msg_list.select_id(page_params.initial_pointer,
|
||||
home_msg_list.select_id(page_params.pointer,
|
||||
{then_scroll: true, use_closest: true,
|
||||
target_scroll_offset: page_params.initial_offset});
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ util.execute_early(function () {
|
|||
|
||||
if (page_params.have_initial_messages) {
|
||||
exports.load_old_messages({
|
||||
anchor: page_params.initial_pointer,
|
||||
anchor: page_params.pointer,
|
||||
num_before: 200,
|
||||
num_after: 200,
|
||||
msg_list: home_msg_list,
|
||||
|
|
|
@ -99,8 +99,8 @@ exports.activate = function (raw_operators, opts) {
|
|||
|
||||
if (opts.then_select_id === -1 && !opts.first_unread_from_server) {
|
||||
// According to old comments, this shouldn't happen anymore
|
||||
blueslip.warn("Setting then_select_id to page_params.initial_pointer.");
|
||||
opts.then_select_id = page_params.initial_pointer;
|
||||
blueslip.warn("Setting then_select_id to page_params.pointer.");
|
||||
opts.then_select_id = page_params.pointer;
|
||||
opts.select_first_unread = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ exports.fast_forward_pointer = function () {
|
|||
};
|
||||
|
||||
exports.initialize = function initialize() {
|
||||
pointer.server_furthest_read = page_params.initial_pointer;
|
||||
pointer.server_furthest_read = page_params.pointer;
|
||||
if (page_params.orig_initial_pointer !== undefined &&
|
||||
page_params.orig_initial_pointer > pointer.server_furthest_read) {
|
||||
pointer.server_furthest_read = page_params.orig_initial_pointer;
|
||||
|
|
|
@ -135,8 +135,8 @@ exports.initialize = function reload__initialize() {
|
|||
var pointer = parseInt(vars.pointer, 10);
|
||||
|
||||
if (pointer) {
|
||||
page_params.orig_initial_pointer = page_params.initial_pointer;
|
||||
page_params.initial_pointer = pointer;
|
||||
page_params.orig_initial_pointer = page_params.pointer;
|
||||
page_params.pointer = pointer;
|
||||
}
|
||||
var offset = parseInt(vars.offset, 10);
|
||||
if (offset) {
|
||||
|
|
|
@ -72,7 +72,6 @@ class HomeTest(ZulipTestCase):
|
|||
"has_mobile_devices",
|
||||
"have_initial_messages",
|
||||
"hotspots",
|
||||
"initial_pointer",
|
||||
"initial_servertime",
|
||||
"is_admin",
|
||||
"language_list",
|
||||
|
@ -91,6 +90,7 @@ class HomeTest(ZulipTestCase):
|
|||
"never_subscribed",
|
||||
"notifications_stream",
|
||||
"pm_content_in_desktop_notifications",
|
||||
"pointer",
|
||||
"poll_timeout",
|
||||
"presences",
|
||||
"prompt_for_invites",
|
||||
|
@ -353,7 +353,7 @@ class HomeTest(ZulipTestCase):
|
|||
page_params = self._get_page_params(result)
|
||||
self.assertEqual(page_params['narrow_stream'], stream_name)
|
||||
self.assertEqual(page_params['narrow'], [dict(operator='stream', operand=stream_name)])
|
||||
self.assertEqual(page_params['initial_pointer'], -1)
|
||||
self.assertEqual(page_params['pointer'], -1)
|
||||
self.assertEqual(page_params['max_message_id'], -1)
|
||||
self.assertEqual(page_params['have_initial_messages'], False)
|
||||
|
||||
|
|
|
@ -204,10 +204,6 @@ def home_real(request):
|
|||
server_inline_image_preview = settings.INLINE_IMAGE_PREVIEW,
|
||||
server_inline_url_embed_preview = settings.INLINE_URL_EMBED_PREVIEW,
|
||||
|
||||
# Realm foreign key data from register_ret.
|
||||
# TODO: Rename these to match register_ret values.
|
||||
initial_pointer = register_ret['pointer'],
|
||||
|
||||
# Misc. extra data.
|
||||
have_initial_messages = user_has_messages,
|
||||
initial_servertime = time.time(), # Used for calculating relative presence age
|
||||
|
@ -260,6 +256,7 @@ def home_real(request):
|
|||
'muted_topics',
|
||||
'never_subscribed',
|
||||
'pm_content_in_desktop_notifications',
|
||||
'pointer',
|
||||
'presences',
|
||||
'queue_id',
|
||||
'realm_add_emoji_by_admins_only',
|
||||
|
@ -318,7 +315,7 @@ def home_real(request):
|
|||
page_params["narrow_topic"] = narrow_topic
|
||||
page_params["narrow"] = [dict(operator=term[0], operand=term[1]) for term in narrow]
|
||||
page_params["max_message_id"] = initial_pointer
|
||||
page_params["initial_pointer"] = initial_pointer
|
||||
page_params["pointer"] = initial_pointer
|
||||
page_params["have_initial_messages"] = (initial_pointer != -1)
|
||||
page_params["enable_desktop_notifications"] = False
|
||||
|
||||
|
|
Loading…
Reference in New Issue