Phase 1: quick flow fixes

- One message per job: the status message is deleted once the file is
  sent, or shortened to "Sent." when Telegram keeps it.
- No reply quotes in private chats; groups keep them.
- Queue status only mentions the position when the wait is above
  QUEUE_NOTICE_THRESHOLD_SECONDS or somebody is ahead. Status edits are
  throttled to one per 2.5 s per message; a state that arrives too soon
  is shown later instead of dropped. The wait estimate is 0 with a free
  slot.
- Caption with title (uploader and date when generic), uploader,
  duration, a short source link without tracking parameters and an
  optional "via @bot" line (CAPTION_ATTRIBUTION). Uploaded videos get a
  320 px JPEG thumbnail; merged MP4s are written with faststart.
- Buttons under the result: Audio (MP3), Other quality, Thumbnail,
  Delete. Requester only in groups.
- Language resolved once per update and passed in the context. A
  fallback to English is logged as a bug; a test walks every screen in
  Spanish and Dutch. Language picker on the first /start.
- Sizes without a zero decimal ("50 MB").
- First link of a new user shows the card once and sets the default to
  "best that fits my limit".
- Errors offer the next step (Try again, Smaller quality, Upgrade, Open
  app); passing lookup failures are retried once.
- Up to MULTI_LINK_MAX links per message; a link sent a moment ago gets
  "already sent" with a Send again button.
- Mini App menu button, labelled per private chat in the user's
  language.
- Personal /settings in private chats with an "Add me to a group"
  button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michilis
2026-11-18 20:08:58 +00:00
co-authored by Claude Opus 5.5
parent 3c153af97f
commit 6843053582
52 changed files with 3369 additions and 271 deletions
+14 -3
View File
@@ -391,7 +391,7 @@ func TestMiniAppHistoryResend(t *testing.T) {
if again.Params["video"] == "" || len(again.Files) != 0 {
t.Fatalf("the resend should reuse Telegram's copy: params %v, %d uploads", again.Params, len(again.Files))
}
h.wait(seq, edits, func(c fakeserver.Call) bool { return c.ChatID() == alice && strings.Contains(c.Text(), "Done") })
h.finished(seq, alice)
// One real download happened, and both deliveries count as usage.
if n := len(h.fake.Downloads()); n != 1 {
t.Fatalf("%d downloads ran, want 1", n)
@@ -670,13 +670,24 @@ func TestMiniAppPreferences(t *testing.T) {
// A default format has to be a video or audio format.
h.refused(h.call(alice, "PUT", "me", map[string]any{"quality": "thumb"}), http.StatusBadRequest, "bad_request")
h.refused(h.call(alice, "PUT", "me", map[string]any{"lang": "tlh"}), http.StatusBadRequest, "bad_request")
// "" is "ask every time" in the app, as for groups; "fit" is the best
// quality that fits the limit, which is also what a new user gets.
h.must(alice, "PUT", "me", map[string]any{"quality": ""})
if me := h.must(alice, "GET", "me", nil); me.str("quality") != "" {
t.Fatalf("me after ask = %s", me.Raw)
}
h.must(alice, "PUT", "me", map[string]any{"lang": "en"})
u, err := h.app.Store.GetUser(ctx, alice)
if err != nil || u.LangOverride != "en" || u.Quality != "" {
if err != nil || u.LangOverride != "en" || u.Quality != "ask" {
t.Fatalf("user = %+v, %v", u, err)
}
h.must(alice, "PUT", "me", map[string]any{"quality": "fit"})
if me := h.must(alice, "GET", "me", nil); me.str("quality") != "fit" {
t.Fatalf("me after fit = %s", me.Raw)
}
if me := h.must(bob, "GET", "me", nil); me.str("quality") != "fit" {
t.Fatalf("a new user's quality = %s", me.Raw)
}
h.must(alice, "PUT", "me", map[string]any{"lang": "auto"})
if u, _ = h.app.Store.GetUser(ctx, alice); u.LangOverride != "" {
t.Fatalf("language override = %q, want none", u.LangOverride)