mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
ui_init: Pass params to pm_conversations.recent.
This is follow up to da79fd206a
I accidentally skipped over pm_conversations. Same
ideas as the bigger previous commit--we pass in params
to the initialize function and do the delete cleanup
within ui_init.
This commit is contained in:
@@ -16,7 +16,7 @@ run_test('partners', () => {
|
||||
zrequire("people");
|
||||
|
||||
run_test('insert_recent_private_message', () => {
|
||||
set_global('page_params', {
|
||||
const params = {
|
||||
recent_private_conversations: [
|
||||
{user_ids: [11, 2],
|
||||
max_message_id: 150,
|
||||
@@ -28,9 +28,9 @@ run_test('insert_recent_private_message', () => {
|
||||
max_message_id: 7,
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
people.initialize_current_user(15);
|
||||
pmc.recent.initialize();
|
||||
pmc.recent.initialize(params);
|
||||
|
||||
assert.deepEqual(pmc.recent.get(), [
|
||||
{user_ids_string: '2,11', max_message_id: 150},
|
||||
|
||||
@@ -70,12 +70,10 @@ exports.recent = (function () {
|
||||
return _.pluck(recent_private_messages, 'user_ids_string');
|
||||
};
|
||||
|
||||
self.initialize = function () {
|
||||
for (const conversation of page_params.recent_private_conversations) {
|
||||
self.initialize = function (params) {
|
||||
for (const conversation of params.recent_private_conversations) {
|
||||
self.insert(conversation.user_ids, conversation.max_message_id);
|
||||
}
|
||||
|
||||
delete page_params.recent_private_messages;
|
||||
};
|
||||
|
||||
return self;
|
||||
|
||||
@@ -394,6 +394,10 @@ exports.initialize_everything = function () {
|
||||
'cross_realm_bots'
|
||||
);
|
||||
|
||||
const pm_conversations_params = pop_fields(
|
||||
'recent_private_conversations'
|
||||
);
|
||||
|
||||
const presence_params = pop_fields(
|
||||
'presences',
|
||||
'initial_servertime'
|
||||
@@ -422,7 +426,7 @@ exports.initialize_everything = function () {
|
||||
stream_color.initialize();
|
||||
stream_edit.initialize();
|
||||
stream_data.initialize(stream_data_params);
|
||||
pm_conversations.recent.initialize();
|
||||
pm_conversations.recent.initialize(pm_conversations_params);
|
||||
muting.initialize();
|
||||
subs.initialize();
|
||||
stream_list.initialize();
|
||||
|
||||
Reference in New Issue
Block a user