diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-24 17:35:09 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-24 17:35:09 +0200 |
commit | ff16d94cc56e4729d55936cd8460e1940081f03f (patch) | |
tree | 49e7189caeb516ff255d9cb16decd3b90b77a6ea /module/entry-points | |
parent | Error on failed save. (diff) | |
download | calp-ff16d94cc56e4729d55936cd8460e1940081f03f.tar.gz calp-ff16d94cc56e4729d55936cd8460e1940081f03f.tar.xz |
Use X-HNH-REMOVED to "remove" an event.
Diffstat (limited to 'module/entry-points')
-rw-r--r-- | module/entry-points/server.scm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm index 7b323d8e..711119e4 100644 --- a/module/entry-points/server.scm +++ b/module/entry-points/server.scm @@ -113,8 +113,17 @@ "uid required")) (aif (get-event-by-uid uid) - (begin (remove-event it) - (return (build-response code: 204) "")) + (begin + ;; It's hard to properly remove a file. I also want a way to undo accidental + ;; deletions. Therefore I simply save the X-HNH-REMOVED flag to the file, and + ;; then simple don't use those events when loading. + (set! (prop it 'X-HNH-REMOVED) #t) + (set! (param (prop* it 'X-HNH-REMOVED) 'VALUE) "BOOLEAN") + (unless ((@ (output vdir) save-event) it) + (return (build-response code: 500) + "Saving event to disk failed.")) + (remove-event it) + (return (build-response code: 204) "")) (return (build-response code: 400) (format #f "No event with UID '~a'" uid)))) |