Skip to content

Commit

Permalink
fix: address @jeronimoalbi review
Browse files Browse the repository at this point in the history
  • Loading branch information
x1unix committed Dec 19, 2024
1 parent 88a7e5c commit 0e56dab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/gno.land/r/demo/boards2/flag.gno
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ func NewFlag(creator std.Address, reason string) Flag {
}

type Flaggable interface {
// AddFlag adds a new flag to an entry.
// AddFlag adds a new flag to an item.
//
// Returns false if item was already flagged by user.
AddFlag(flag Flag) bool

// FlagsCount returns number of times entry was flagged.
// FlagsCount returns number of times item was flagged.
FlagsCount() int
}

Expand All @@ -40,7 +40,7 @@ func flagItem(item Flaggable, flag Flag) bool {
}

if !item.AddFlag(flag) {
panic("item has been already flagged by a user")
panic("item has been already flagged by a current user")
}

return item.FlagsCount() == flagThreshold
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/boards2/public.gno
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func CreateBoard(name string) BoardID {

func FlagThread(bid BoardID, postID PostID, reason string) {
caller := std.GetOrigCaller()
// TODO: Replace by assertHasBoardPermission() when supported
assertHasPermission(caller, PermissionThreadFlag)

board := mustGetBoard(bid)
Expand Down Expand Up @@ -92,6 +93,7 @@ func CreateReply(bid BoardID, threadID, replyID PostID, body string) PostID {

func FlagReply(bid BoardID, threadID, replyID PostID, reason string) {
caller := std.GetOrigCaller()
// TODO: Replace by assertHasBoardPermission() when supported
assertHasPermission(caller, PermissionThreadFlag)

board := mustGetBoard(bid)
Expand Down

0 comments on commit 0e56dab

Please sign in to comment.