adventure: stay out of the room when TwinBee already said it
gogobee announces treasure finds, duels, mischief contracts and the Siege to the games room in TwinBee's voice, and files the same moments here as facts. Both land in the same room, so the realm heard every one of them twice, in two voices, minutes apart. Hold those types back from Matrix. They are stored and published on the site exactly as before, and the push alerts still fire; only the live priority beat and the digest sweep skip them, retired against the digest the same way a no_push backfill is. Types with no room announce behind them (zone clears, arrivals, deaths, milestones) are untouched and stay Pete's to report. room_silent_types overrides the default set; an explicit empty list turns the suppression off.
This commit is contained in:
@@ -162,10 +162,12 @@ func TestAdventureDigest(t *testing.T) {
|
||||
now := time.Now()
|
||||
|
||||
// Two bulletins + one priority (which posts live and must be excluded).
|
||||
// Both bulletin types are ones TwinBee does NOT announce itself — a
|
||||
// room-silent type never reaches the digest (see TestAdventureRoomSilent).
|
||||
postFact(t, s, token, AdvFact{GUID: "arrival:a:1", EventType: "arrival", Tier: "bulletin",
|
||||
Actors: []string{"Zapp"}, Subject: "Zapp", ClassRace: "Elf Ranger", OccurredAt: now.Unix()})
|
||||
postFact(t, s, token, AdvFact{GUID: "rival:b:2", EventType: "rival_result", Tier: "bulletin",
|
||||
Actors: []string{"Kif", "Zapp"}, Subject: "Kif", Opponent: "Zapp", Outcome: "won", OccurredAt: now.Unix()})
|
||||
postFact(t, s, token, AdvFact{GUID: "milestone:b:2", EventType: "milestone", Tier: "bulletin",
|
||||
Actors: []string{"Kif"}, Subject: "Kif", Milestone: "Ten zones cleared", OccurredAt: now.Unix()})
|
||||
postFact(t, s, token, AdvFact{GUID: "death:c:3", EventType: "death", Tier: "priority",
|
||||
Actors: []string{"Brannigan"}, Subject: "Brannigan", Zone: "the Underforge", Level: 9, OccurredAt: now.Unix()})
|
||||
if len(*posted) != 1 {
|
||||
@@ -191,6 +193,43 @@ func TestAdventureDigest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdventureRoomSilent: an event type gogobee announces in the games room
|
||||
// itself is published to the site but never reaches Matrix — not as a live
|
||||
// priority beat, and not swept into the next digest either.
|
||||
func TestAdventureRoomSilent(t *testing.T) {
|
||||
const token = "t"
|
||||
s, posted := newAdvServer(t, token)
|
||||
now := time.Now()
|
||||
|
||||
postFact(t, s, token, AdvFact{GUID: "treasure_found:e:5", EventType: "treasure_found", Tier: "priority",
|
||||
Actors: []string{"Rurina"}, Subject: "Rurina", Zone: "Dragon's Lair", Level: 20,
|
||||
Stakes: "The Cartographer's Final Map", Outcome: "legendary", OccurredAt: now.Unix()})
|
||||
if len(*posted) != 0 {
|
||||
t.Fatalf("room-silent beat posted live: %d posts, want 0", len(*posted))
|
||||
}
|
||||
|
||||
// The site keeps the full record — suppression is Matrix-only.
|
||||
got, err := storage.GetStoryByGUID("treasure_found:e:5")
|
||||
if err != nil || got == nil {
|
||||
t.Fatalf("room-silent beat missing from the site: %v", err)
|
||||
}
|
||||
|
||||
// And it doesn't come back around in the roundup.
|
||||
s.postDailyDigest(now.UTC())
|
||||
if len(*posted) != 0 {
|
||||
t.Errorf("room-silent beat swept into digest: %d posts, want 0", len(*posted))
|
||||
}
|
||||
|
||||
// An explicit empty list turns suppression off: the same beat posts live.
|
||||
s.roomSilent = config.AdventureConfig{RoomSilentTypes: []string{}}.RoomSilentSet()
|
||||
postFact(t, s, token, AdvFact{GUID: "treasure_found:e:6", EventType: "treasure_found", Tier: "priority",
|
||||
Actors: []string{"Rurina"}, Subject: "Rurina", Zone: "Dragon's Lair", Level: 20,
|
||||
Stakes: "The Cartographer's Final Map", Outcome: "legendary", OccurredAt: now.Unix()})
|
||||
if len(*posted) != 1 {
|
||||
t.Errorf("suppression off: %d posts, want 1", len(*posted))
|
||||
}
|
||||
}
|
||||
|
||||
// TestAdventureArtAndMeta covers the visual-identity slice: the emblem endpoint
|
||||
// returns a themed SVG, ingested cards carry its local path, and the permalink
|
||||
// page is noindex with an og:image.
|
||||
|
||||
Reference in New Issue
Block a user