Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAlliance request event cards now filter out entries when the requestor player is dead. The ChangesAlliance request visibility filtering
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed due to a network error. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Re: not knowing how to "create and then kill a player" — good news, you don't need a real player at all. The existing tests in this file just stub Since the filter lives in test("removes ALLIANCE_REQUEST when the requestor is dead", () => {
const display = new ActionableEvents();
const myPlayer = { isAlive: () => true, alliances: () => [], smallID: () => 1 };
// dead but still "requesting" — proves the new isAlive() guard is what removes it
const deadRequestor = { isAlive: () => false, isRequestingAllianceWith: () => true };
const aliveRequestor = { isAlive: () => true, isRequestingAllianceWith: () => true };
const players: Record<number, any> = { 2: deadRequestor, 3: aliveRequestor };
(display as any).game = {
inSpawnPhase: () => false,
myPlayer: () => myPlayer,
updatesSinceLastTick: () => null, // skips the updateMap loop
ticks: () => 0,
playerBySmallID: (id: number) => players[id],
};
(display as any).requestUpdate = () => {};
(display as any)._isVisible = true;
(display as any).events = [
{ description: "from dead", type: MessageType.ALLIANCE_REQUEST, requestorID: 2, createdAt: 0 },
{ description: "from alive", type: MessageType.ALLIANCE_REQUEST, requestorID: 3, createdAt: 0 },
];
(display as any).tick();
const remaining = (display as any).events;
expect(remaining.some((e: any) => e.requestorID === 2)).toBe(false); // dead → removed
expect(remaining.some((e: any) => e.requestorID === 3)).toBe(true); // alive → kept
});A good set would be: dead → removed (the fix), alive + still requesting → kept, alive + no longer requesting → removed (proves you didn't break the old behavior — just Optional: since the filter is inline in |
|
Oh, thank you very much @Celant ! |
Resolves #4220
Description:
Filters
ActionableEventsto remove dead requestors.Please complete the following:
I do not know how to create and then kill a player in
tests/client/graphics/layers/ActionableEventsAlliance.test.ts.Please put your Discord username so you can be contacted if a bug or regression is found:
Katokoda