-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea4866e
commit 877ed1a
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var ( | ||
bid boards2.BoardID | ||
pid boards2.PostID | ||
) | ||
|
||
func init() { | ||
std.TestSetOrigCaller(owner) | ||
bid = boards2.CreateBoard("test-board") | ||
pid = boards2.CreateThread(bid, "Foo", "bar") | ||
|
||
boards2.SetFlaggingThreshold(bid, 2) | ||
boards2.FlagThread(bid, pid, "") | ||
} | ||
|
||
func main() { | ||
boards2.FlagThread(bid, pid, "") | ||
} | ||
|
||
// Error: | ||
// item has been already flagged by a current user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
var bid boards2.BoardID | ||
|
||
func init() { | ||
std.TestSetOrigCaller(owner) | ||
bid = boards2.CreateBoard("test-board") | ||
} | ||
|
||
func main() { | ||
boards2.SetFlaggingThreshold(bid, 4) | ||
|
||
// Ensure that flagging threshold changed | ||
println(boards2.GetFlaggingThreshold(bid)) | ||
} | ||
|
||
// Output: | ||
// 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
const bid boards2.BoardID = 404 | ||
|
||
func init() { | ||
std.TestSetOrigCaller(owner) | ||
} | ||
|
||
func main() { | ||
boards2.SetFlaggingThreshold(bid, 1) | ||
} | ||
|
||
// Error: | ||
// board does not exist with ID: 404 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package main | ||
|
||
import ( | ||
"std" | ||
|
||
boards2 "gno.land/r/nt/boards2/v1" | ||
) | ||
|
||
const owner = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1 | ||
|
||
func init() { | ||
std.TestSetOrigCaller(owner) | ||
} | ||
|
||
func main() { | ||
boards2.SetFlaggingThreshold(1, 0) | ||
} | ||
|
||
// Error: | ||
// invalid flagging threshold |