Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_ui_reply_02_filetest.gno

2.52 Kb · 76 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_ui_reply_02_filetest
 2
 3// Render comment/reply view of a flagged comment.
 4package z_ui_reply_02_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards/v0"
10
11	boards2 "gno.land/r/gnoland/boards2/v0"
12)
13
14const (
15	owner     address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
16	boardName         = "test-board"
17)
18
19var (
20	threadID boards.ID
21	replyID  boards.ID
22)
23
24func init(cur realm) {
25	testing.SetRealm(testing.NewUserRealm(owner))
26
27	// Create a board and a thread
28	boardID := boards2.CreateBoard(cross(cur), boardName, false, false)
29	threadID = boards2.CreateThread(cross(cur), boardID, "Foo", "Body")
30
31	// Create a comments with a reply
32	replyID = boards2.CreateReply(cross(cur), boardID, threadID, 0, "Second comment")
33	boards2.CreateReply(cross(cur), boardID, threadID, replyID, "Third comment")
34
35	// Flag the comment
36	boards2.FlagReply(cross(cur), boardID, threadID, replyID, "Reason")
37}
38
39func main() {
40	path := boardName + "/" + threadID.String() + "/" + replyID.String()
41	println(boards2.Render(path))
42}
43
44// Output:
45// ## Foo
46//
47// **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC
48//
49//
50// <gno-foreign>
51// Body
52// </gno-foreign>
53//
54//
55//
56// ↳ [Flag](/r/gnoland/boards2/v0:test-board/1/flag) • [Repost](/r/gnoland/boards2/v0:test-board/1/repost) • [Comment](/r/gnoland/boards2/v0:test-board/1/reply) [1] • [Edit](/r/gnoland/boards2/v0:test-board/1/edit) • [Delete](/r/gnoland/boards2/v0$help&func=DeleteThread&boardID=1&threadID=1) • [Show all Replies](/r/gnoland/boards2/v0:test-board/1)
57//
58//
59// >
60// > **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC [\#2](/r/gnoland/boards2/v0:test-board/1/2)
61// > ⚠ Reply is hidden as it has been flagged as [inappropriate](/r/gnoland/boards2/v0:test-board/1/2/flagging-reasons)
62//
63// ---
64// Sort by: [newest first](/r/gnoland/boards2/v0:test-board/1/2?order=desc)
65// >
66// > >
67// > > **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC [\#3](/r/gnoland/boards2/v0:test-board/1/3)
68// > >
69// > >
70// > > <gno-foreign>
71// > > Third comment
72// > > </gno-foreign>
73// > >
74// > >
75// > >
76// > > ↳ [Flag](/r/gnoland/boards2/v0:test-board/1/3/flag) • [Reply](/r/gnoland/boards2/v0:test-board/1/3/reply) • [Edit](/r/gnoland/boards2/v0:test-board/1/3/edit) • [Delete](/r/gnoland/boards2/v0$help&func=DeleteReply&boardID=1&replyID=3&threadID=1)