summaryrefslogtreecommitdiff
path: root/examples/updateable/content/song.go
diff options
context:
space:
mode:
authorKevin Keuning <kkeuning@gmail.com>2017-03-10 04:06:30 -0600
committerKevin Keuning <kkeuning@gmail.com>2017-03-10 04:06:30 -0600
commit8c5343745b09b0993bf869ef03d44b3a75d29a0e (patch)
treeeafbb6a5d235361d3907584e8192a13c45b0f7f5 /examples/updateable/content/song.go
parentba940e24fcac76b87ddd97fe5ebf722e842efb4c (diff)
added AfterAcceptUpdate to example
Diffstat (limited to 'examples/updateable/content/song.go')
-rw-r--r--examples/updateable/content/song.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/updateable/content/song.go b/examples/updateable/content/song.go
index 7b73a85..ba806bd 100644
--- a/examples/updateable/content/song.go
+++ b/examples/updateable/content/song.go
@@ -184,6 +184,17 @@ func (s *Song) AfterAccept(res http.ResponseWriter, req *http.Request) error {
return nil
}
+// AfterAcceptUpdate is called after AcceptUpdate, and is useful for logging or triggering
+// notifications, etc. after the data is saved to the database, etc.
+// The request has a context containing the databse 'target' affected by the
+// request.
+func (s *Song) AfterAcceptUpdate(res http.ResponseWriter, req *http.Request) error {
+ addr := req.RemoteAddr
+ log.Println("Song updated by:", addr, "titled:", req.PostFormValue("title"))
+
+ return nil
+}
+
// Approve implements editor.Mergeable, which enables content supplied by external
// clients to be approved and thus added to the public content API. Before content
// is approved, it is waiting in the Pending bucket, and can only be approved in