Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_thread_05_filetest.gno

0.96 Kb · 39 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_ui_thread_05_filetest
 2
 3// Render thread which has been flagged.
 4package z_ui_thread_05_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards"
10
11	boards2 "gno.land/r/gnoland/boards2/v1"
12)
13
14const (
15	owner     address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
16	boardName         = "BoardName"
17)
18
19var threadID boards.ID
20
21func init(cur realm) {
22	testing.SetRealm(testing.NewUserRealm(owner))
23
24	// Create a readonly board and then add a thread
25	boardID := boards2.CreateBoard(cross(cur), boardName, false, false)
26	threadID = boards2.CreateThread(cross(cur), boardID, "Foo", "Body")
27
28	// Flag the thread
29	boards2.SetFlaggingThreshold(cross(cur), boardID, 1)
30	boards2.FlagThread(cross(cur), boardID, threadID, "Reason")
31}
32
33func main() {
34	path := boardName + "/" + threadID.String()
35	println(boards2.Render(path))
36}
37
38// Output:
39// ⚠ Thread has been flagged as [inappropriate](/r/gnoland/boards2/v1:BoardName/1/flagging-reasons)