MCPcopy Index your code
hub / github.com/ether/etherpad / getChatMessages

Method getChatMessages

src/node/db/Pad.ts:568–582  ·  view source on GitHub ↗

* @param {number} start - ID of the first desired chat message. * @param {number} end - ID of the last desired chat message. * @returns {ChatMessage[]} Any existing messages with IDs between `start` (inclusive) and `end` * (inclusive), in order. Note: `start` and `end` form a closed int

(start: string, end: number)

Source from the content-addressed store, hash-verified

566 * interval as is typical in code.
567 */
568 async getChatMessages(start: string, end: number) {
569 const entries =
570 await Promise.all(Stream.range(start, end + 1).map(this.getChatMessage.bind(this)));
571
572 // sort out broken chat entries
573 // it looks like in happened in the past that the chat head was
574 // incremented, but the chat message wasn't added
575 return entries.filter((entry) => {
576 const pass = (entry != null);
577 if (!pass) {
578 console.warn(`WARNING: Found broken chat entry in pad ${this.id}`);
579 }
580 return pass;
581 });
582 }
583
584 async init(text:string, authorId = '') {
585 // try to load the pad

Callers 2

API.tsFile · 0.80
handleGetChatMessagesFunction · 0.80

Calls 3

mapMethod · 0.80
rangeMethod · 0.80
bindMethod · 0.45

Tested by

no test coverage detected