diff --git a/internal/modules/misc/handlers_test.go b/internal/modules/misc/handlers_test.go index 75d7c49..0a31c83 100644 --- a/internal/modules/misc/handlers_test.go +++ b/internal/modules/misc/handlers_test.go @@ -514,12 +514,15 @@ func TestFF_UppercaseFormDispatches(t *testing.T) { } } -func TestXLT1_DeniedToNonAdmin(t *testing.T) { +// Public, unlike its /ff counterpart — anyone in the group can be made to +// file the paperwork. +func TestXLT1_AllowedToNonAdmin(t *testing.T) { rb, _ := installMisc(t, 999) - rb.Bot.ProcessUpdate(context.Background(), testutil.NewPrivateMessage(7, "/xlt1")) - if calls := rb.Sent(); len(calls) != 0 { - t.Errorf("non-admin /xlt1 replied: %+v", calls) + rb.Bot.ProcessUpdate(context.Background(), messageFrom(t, "/xlt1", + &models.User{ID: 7, Username: "nobody"})) + if got := rb.LastSent().Text(); got != fmt.Sprintf(xlt1Template, "@nobody", "@nobody") { + t.Errorf("non-admin /xlt1 reply = %q, want the xlt1 petition", got) } } diff --git a/internal/modules/misc/misc.go b/internal/modules/misc/misc.go index db4eff4..a271e48 100644 --- a/internal/modules/misc/misc.go +++ b/internal/modules/misc/misc.go @@ -1,7 +1,7 @@ // Package misc is a small stub module that proves the framework end-to-end: // /ping (public, exercises KV write), /ping_stats (protected, exercises KV // read), /random (public random picker), /wheelofnames (public wheel picker -// with optional GIF), /ff (protected give-up-on-T1 rant), /xlt1 (protected +// with optional GIF), /ff (protected give-up-on-T1 rant), /xlt1 (public // apologise-to-T1 petition, the sequel to /ff), /the_answer (private easter // egg), and small public disclaimer commands. package misc diff --git a/internal/modules/misc/misc_test.go b/internal/modules/misc/misc_test.go index d00ae7b..c2d9982 100644 --- a/internal/modules/misc/misc_test.go +++ b/internal/modules/misc/misc_test.go @@ -26,7 +26,7 @@ func TestNew_RegistersExpectedCommands(t *testing.T) { "random": modules.VisibilityPublic, "wheelofnames": modules.VisibilityPublic, "ff": modules.VisibilityProtected, - "xlt1": modules.VisibilityProtected, + "xlt1": modules.VisibilityPublic, "the_answer": modules.VisibilityPrivate, "trongtruonghop": modules.VisibilityPublic, "tth": modules.VisibilityPublic, diff --git a/internal/modules/misc/xlt1_command.go b/internal/modules/misc/xlt1_command.go index cedb4fb..80b8007 100644 --- a/internal/modules/misc/xlt1_command.go +++ b/internal/modules/misc/xlt1_command.go @@ -66,7 +66,7 @@ Tôi xin trân trọng cảm ơn! 🙏 func xlt1Command() modules.Command { return modules.Command{ Name: "xlt1", - Visibility: modules.VisibilityProtected, + Visibility: modules.VisibilityPublic, Description: "Văn mẫu đơn xin lỗi T1 — dành cho lúc trù xong phải quay xe", Handler: func(ctx context.Context, b *bot.Bot, update *models.Update) error { if update.Message == nil { diff --git a/plans/reports/research-260902-1547-xlt1-don-xin-loi-t1.md b/plans/reports/research-260902-1547-xlt1-don-xin-loi-t1.md index 1b959b3..e403e0a 100644 --- a/plans/reports/research-260902-1547-xlt1-don-xin-loi-t1.md +++ b/plans/reports/research-260902-1547-xlt1-don-xin-loi-t1.md @@ -83,7 +83,7 @@ Bổ sung từ search: meme "tê liệt / ngồi xe lăn" (fan lẫn anti dùng |---|---|---| | Tên | `xlt1` | khớp `^[a-z0-9_]{1,32}$` (`internal/modules/validate.go:10`) | | Module | `misc` | cùng chỗ với `/ff`, `/tth` | -| Visibility | `Protected` | soi chiếu `/ff` — cùng thể loại văn mẫu spam nhóm | +| Visibility | `Public` | user chốt: ai trong nhóm cũng phải làm được đơn; soi chiếu `/tth` chứ không phải `/ff` | | Nội suy | mention người gửi ×2 | dùng lại `senderMention()` sẵn có (DRY); lấp ô "Tôi tên là" + "Người làm đơn" | | Parse mode | HTML | mention cần thẻ ``; giống `disclaimerCommand` | | Tham số | không | như `/ff`, args bị bỏ qua | @@ -111,5 +111,5 @@ File mới `internal/modules/misc/xlt1_command.go`, một `const` template + m ## Unresolved Questions -1. `/xlt1` nên `Protected` (soi `/ff`) hay `Public` (soi `/tth`)? Đã chọn `Protected`; đổi 1 dòng nếu muốn public. +1. ~~`Protected` hay `Public`?~~ Đã chốt `Public` (2026-09-02). 2. Có cần alias (`/xinloit1`)? Hiện chỉ làm đúng `/xlt1` như yêu cầu.