admin.gno
0.56 Kb ยท 26 lines
1package guestbook
2
3import (
4 "gno.land/p/demo/ownable"
5 "gno.land/p/demo/seqid"
6)
7
8var owner = ownable.NewWithOrigin()
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 crossing()
15 owner.AssertOwnedByPrevious()
16
17 id, err := seqid.FromString(signatureID)
18 if err != nil {
19 panic(err)
20 }
21 idb := id.Binary()
22 if !guestbook.Has(idb) {
23 panic("signature does not exist")
24 }
25 guestbook.Remove(idb)
26}