Search Apps Documentation Source Content File Folder Download Copy

admin.gno

0.53 Kb ยท 25 lines
 1package guestbook
 2
 3import (
 4	"gno.land/p/demo/ownable"
 5	"gno.land/p/demo/seqid"
 6)
 7
 8var owner = ownable.New()
 9
10// AdminDelete removes the guestbook message with the given ID.
11// The user will still be marked as having submitted a message, so they
12// won't be able to re-submit a new message.
13func AdminDelete(signatureID string) {
14	owner.AssertCallerIsOwner()
15
16	id, err := seqid.FromString(signatureID)
17	if err != nil {
18		panic(err)
19	}
20	idb := id.Binary()
21	if !guestbook.Has(idb) {
22		panic("signature does not exist")
23	}
24	guestbook.Remove(idb)
25}