z_ui_thread_14_filetest.gno
1.20 Kb · 44 lines
1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_ui_thread_14_filetest
2
3// In a frozen thread, a reply must not show Reply/Edit/Delete action links
4// (the backend rejects them as the thread is frozen); only Flag remains —
5// matching how the OP and a readonly board already behave.
6package z_ui_thread_14_filetest
7
8import (
9 "strings"
10 "testing"
11
12 "gno.land/p/gnoland/boards"
13
14 boards2 "gno.land/r/gnoland/boards2/v1"
15)
16
17const owner address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
18
19var (
20 bid boards.ID
21 rid, tid boards.ID
22)
23
24func init(cur realm) {
25 testing.SetRealm(testing.NewUserRealm(owner))
26 bid = boards2.CreateBoard(cross(cur), "test-board", false, false)
27 tid = boards2.CreateThread(cross(cur), bid, "Foo", "OP body")
28 rid = boards2.CreateReply(cross(cur), bid, tid, 0, "a reply") // #2
29}
30
31func main(cur realm) {
32 testing.SetRealm(testing.NewUserRealm(owner))
33 boards2.FreezeThread(cross(cur), bid, tid)
34
35 out := boards2.Render("test-board/1")
36 // Reply #2 keeps Flag but loses Reply/Edit/Delete in a frozen thread.
37 ok := strings.Contains(out, "test-board/1/2/flag") &&
38 !strings.Contains(out, "test-board/1/2/edit") &&
39 !strings.Contains(out, "test-board/1/2/reply")
40 println(ok)
41}
42
43// Output:
44// true