diff --git a/tests/src/pagination.ts b/tests/src/pagination.ts index 427d73e..d0fcfd9 100644 --- a/tests/src/pagination.ts +++ b/tests/src/pagination.ts @@ -75,17 +75,17 @@ module.exports = async (orchestrator) => { // Alice lists the messages const getTimestamp = () => (Date.now() * 1000) - let alices_view = await alice_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + let alices_view = await alice_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) - let bobbos_view = await bobbo_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + let bobbos_view = await bobbo_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) if (alices_view.messages.length !== 2) { await delay(10000) console.log("Trying again..."); - alices_view = await alice_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + alices_view = await alice_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) - bobbos_view = await bobbo_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) + bobbos_view = await bobbo_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 2 }) } t.deepEqual(alices_view.messages.length, 2) t.deepEqual(bobbos_view.messages.length, 2) @@ -116,9 +116,9 @@ module.exports = async (orchestrator) => { t.deepEqual(sends[3].entry, recvs[3].entry); await delay(4000) // Alice lists the messages - alices_view = await alice_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 20 }) + alices_view = await alice_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 20 }) // Bobbo lists the messages - bobbos_view = await bobbo_chat.call('chat', 'list_messages_batch', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 10 }) + bobbos_view = await bobbo_chat.call('chat', 'list_page_messages', { channel: channel.entry, active_chatter: false, earlier_than: getTimestamp(), target_message_count: 10 }) bobbos_view.messages.forEach(msg => { console.log(">>>>>>>", msg.entry); }); diff --git a/zomes/chat/src/lib.rs b/zomes/chat/src/lib.rs index 41e37b0..c723705 100644 --- a/zomes/chat/src/lib.rs +++ b/zomes/chat/src/lib.rs @@ -148,7 +148,7 @@ fn list_messages(list_messages_input: ListMessagesInput) -> ExternResult ExternResult { +fn list_page_messages(list_messages_input: ListMessagesBatchInput) -> ExternResult { Ok(message::handlers::list_messages_batch(list_messages_input)?) } diff --git a/zomes/chat/src/validation.rs b/zomes/chat/src/validation.rs index 78f58b0..42642e7 100644 --- a/zomes/chat/src/validation.rs +++ b/zomes/chat/src/validation.rs @@ -50,7 +50,7 @@ pub fn set_read_only_cap_tokens() -> ExternResult<()> { functions.insert((zome_info()?.zome_name, "get_active_chatters".into())); functions.insert((zome_info()?.zome_name, "list_channels".into())); functions.insert((zome_info()?.zome_name, "list_messages".into())); - functions.insert((zome_info()?.zome_name, "list_messages_batch".into())); + functions.insert((zome_info()?.zome_name, "list_page_messages".into())); functions.insert((zome_info()?.zome_name, "list_all_messages".into())); functions.insert((zome_info()?.zome_name, "stats".into())); functions.insert((zome_info()?.zome_name, "agent_stats".into()));