From 8c5343745b09b0993bf869ef03d44b3a75d29a0e Mon Sep 17 00:00:00 2001 From: Kevin Keuning Date: Fri, 10 Mar 2017 04:06:30 -0600 Subject: added AfterAcceptUpdate to example --- examples/updateable/content/song.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'examples') 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 -- cgit v1.2.3