Add video picker and Discord video attachments.
CI / test (pull_request) Successful in 6m29s

The picker accepts one MP4 or WebM, the thread lightbox zooms photos, and Discord gets the video as a file on a follow-up message so photo embeds still render.
This commit is contained in:
2026-08-31 02:00:56 -07:00
parent 84dea8ea5d
commit f96df3222d
22 changed files with 1018 additions and 144 deletions
+41
View File
@@ -102,3 +102,44 @@ func TestBusDropsWhenFull(t *testing.T) {
default:
}
}
func TestNopReleasesPostCreated(t *testing.T) {
t.Parallel()
released := false
Nop{}.Publish(context.Background(), PostCreated{Release: func() { released = true }})
if !released {
t.Fatal("Nop.Publish did not release held upload")
}
}
func TestBusDropReleasesPostCreated(t *testing.T) {
t.Parallel()
bus := newBus(1, false)
bus.Publish(context.Background(), "kept")
released := false
bus.Publish(context.Background(), PostCreated{Release: func() { released = true }})
if !released {
t.Fatal("dropped PostCreated did not release held upload")
}
}
func TestSubscribeReleasePostedToDiscord(t *testing.T) {
t.Parallel()
bus := New()
defer bus.Close()
SubscribeRelease(bus)
released := make(chan struct{})
bus.Publish(context.Background(), PostedToDiscord{
PostID: "post-1",
Release: func() { close(released) },
})
select {
case <-released:
case <-time.After(time.Second):
t.Fatal("PostedToDiscord did not release")
}
}