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

flag.gno

0.54 Kb · 28 lines
 1package hub
 2
 3import (
 4	"gno.land/p/gnoland/boards/v0"
 5)
 6
 7// Flag defines a type for thread and comment flags.
 8type Flag struct {
 9	// user is the user that flagged.
10	user address
11
12	// reason is the reason for flagging.
13	reason string
14}
15
16// User returns the user that flagged.
17func (f Flag) User() address { return f.user }
18
19// Reason returns the reason for flagging.
20func (f Flag) Reason() string { return f.reason }
21
22// NewSafeFlag creates a safe flag.
23func NewSafeFlag(ref boards.Flag) Flag {
24	return Flag{
25		user:   ref.User,
26		reason: ref.Reason,
27	}
28}