fix(api): stop bounding the pin listing by the wall clock (#2549)

This commit is contained in:
Hampus
2026-09-06 19:03:15 +02:00
committed by GitHub
parent 798e64b224
commit 1fb2790bb9
@@ -24,6 +24,8 @@ import type {MessagePersistenceService} from '../message/MessagePersistenceServi
import {createMessageResponseDataService} from '../message/MessageResponseDataService';
import {MessageInteractionBase} from './MessageInteractionBase';
const PIN_LIST_UNBOUNDED_TIMESTAMP = new Date('9999-12-31T23:59:59.999Z');
export class MessagePinService extends MessageInteractionBase {
constructor(
gatewayService: IGatewayService,
@@ -81,7 +83,7 @@ export class MessagePinService extends MessageInteractionBase {
const pageSize = Math.min(limit ?? 50, 50);
const cutoffTimestamp = hasReadHistory ? null : new Date(authChannel.guild!.message_history_cutoff!).getTime();
const filtered: Array<Message> = [];
let before = beforeTimestamp ?? new Date();
let before = beforeTimestamp ?? PIN_LIST_UNBOUNDED_TIMESTAMP;
let exhausted = false;
while (filtered.length <= pageSize && !exhausted) {
const messages = await this.channelRepository.messageInteractions.listChannelPins(