Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_ui_4_g_filetest.gno

1.64 Kb · 49 lines
 1// Render thread repost of a flagged thread.
 2package main
 3
 4import (
 5	"testing"
 6
 7	"gno.land/p/gnoland/boards"
 8
 9	boards2 "gno.land/r/boards000/v1rc1"
10)
11
12const (
13	owner        address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14	srcBoardName         = "BoardName"
15	dstBoardName         = "BoardName2"
16)
17
18var repostThreadID boards.ID
19
20func init() {
21	testing.SetRealm(testing.NewUserRealm(owner))
22
23	// Create a board and a thread
24	boardID := boards2.CreateBoard(cross, srcBoardName, false)
25	threadID := boards2.CreateThread(cross, boardID, "Foo", "Body")
26
27	// Repost thread into a different board
28	dstBoardID := boards2.CreateBoard(cross, dstBoardName, false)
29	repostThreadID = boards2.CreateRepost(cross, boardID, threadID, dstBoardID, "Bar", "Body2")
30
31	// Flag original thread
32	boards2.SetFlaggingThreshold(cross, boardID, 1)
33	boards2.FlagThread(cross, boardID, threadID, "")
34}
35
36func main() {
37	path := dstBoardName + "/" + repostThreadID.String()
38	println(boards2.Render(path))
39}
40
41// Output:
42// # Bar
43//
44// > *⚠ Source post has been flagged as inappropriate*
45// >
46// Body2
47//
48// Created by [g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq](/u/g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq) on 2009-02-13 11:31pm UTC
49// [Flag](/r/gnoland/boards2/v1$help&func=FlagThread&boardID=2&reason=&threadID=1) • [Repost](/r/gnoland/boards2/v1$help&func=CreateRepost&boardID=2&body=&destinationBoardID=&threadID=1&title=) • [Reply](/r/gnoland/boards2/v1$help&func=CreateReply&boardID=2&body=&replyID=0&threadID=1) • [Edit](/r/gnoland/boards2/v1$help&func=EditThread&boardID=2&body=Body2&threadID=1&title=Bar) • [Delete](/r/gnoland/boards2/v1$help&func=DeleteThread&boardID=2&threadID=1)