z_flag_thread_05_filetest.gno
0.94 Kb · 41 lines
1package main
2
3import (
4 "testing"
5
6 "gno.land/p/gnoland/boards"
7
8 boards2 "gno.land/r/gnoland/boards2/v1"
9)
10
11const (
12 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq"
13 moderator address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
14)
15
16var (
17 bid boards.ID
18 pid boards.ID
19)
20
21func init() {
22 testing.SetRealm(testing.NewUserRealm(owner))
23 bid = boards2.CreateBoard(cross, "test-board", false, false)
24 pid = boards2.CreateThread(cross, bid, "Foo", "bar")
25
26 // Invite a member using a role with permission to flag threads
27 boards2.InviteMember(cross, bid, moderator, boards2.RoleModerator)
28}
29
30func main() {
31 testing.SetRealm(testing.NewUserRealm(moderator))
32
33 // Flag thread as moderator
34 boards2.FlagThread(cross, bid, pid, "Reason")
35
36 // Ensure that original thread content not visible
37 println(boards2.Render("test-board/1"))
38}
39
40// Output:
41// ⚠ Thread has been flagged as [inappropriate](/r/gnoland/boards2/v1:test-board/1/flagging-reasons)