Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_flag_thread_06_filetest.gno

1.01 Kb · 43 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	// Created a board with a specific flagging threshold
23	testing.SetRealm(testing.NewUserRealm(owner))
24	bid = boards2.CreateBoard(cross, "test-board", false, false)
25	boards2.SetFlaggingThreshold(cross, bid, 2)
26
27	// Invite a moderator to the new board
28	boards2.InviteMember(cross, bid, moderator, boards2.RoleModerator)
29
30	// Create a new thread and flag it as a moderator
31	testing.SetRealm(testing.NewUserRealm(moderator))
32	pid = boards2.CreateThread(cross, bid, "Foo", "bar")
33	boards2.FlagThread(cross, bid, pid, "Reason")
34}
35
36func main() {
37	testing.SetRealm(testing.NewUserRealm(moderator))
38
39	boards2.FlagThread(cross, bid, pid, "Reason")
40}
41
42// Error:
43// post has been already flagged by g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj