|
|
|
@ -1138,8 +1138,33 @@
|
|
|
|
|
(redirect "/login"))))))) |
|
|
|
|
|
|
|
|
|
(defroute ("/edit/archive-keywords" :method :POST) () |
|
|
|
|
(utils:set-alert "ROUTE NOT IMPLEMENTED") |
|
|
|
|
(redirect "/user/archive")) |
|
|
|
|
(destructuring-bind |
|
|
|
|
(&key archive-slug new-keywords authenticity-token &allow-other-keys) |
|
|
|
|
(utils:request-params (lack.request:request-body-parameters ningle:*request*)) |
|
|
|
|
(cond ((not (string= authenticity-token (auth:csrf-token))) |
|
|
|
|
`(,+forbidden+ (:content-type "text/plain") ("Denied"))) |
|
|
|
|
(t (hermetic:auth |
|
|
|
|
(:administrator) |
|
|
|
|
;; Authorised |
|
|
|
|
(cond ((find t (mapcar #'utils:string-is-nil-or-empty? |
|
|
|
|
`(,archive-slug ,new-keywords))) |
|
|
|
|
(utils:set-alert "Missing data. Keywords not updated.") |
|
|
|
|
(redirect "/user/archive")) |
|
|
|
|
|
|
|
|
|
((null (nera:get-archive-entry :slug archive-slug)) |
|
|
|
|
(utils:set-alert "Cannot file archive entry. Keywords not updated.") |
|
|
|
|
(redirect "/user/archive")) |
|
|
|
|
|
|
|
|
|
(t (nera:update-archive-entry-property |
|
|
|
|
:slug archive-slug |
|
|
|
|
:property 'archive::keywords-of |
|
|
|
|
:value (utils:format-keywords new-keywords)) |
|
|
|
|
;; Integrate updating Meilisearch here. |
|
|
|
|
(utils:set-alert "Archive entry updated.") |
|
|
|
|
(redirect (format nil "/edit/archive/~a" archive-slug)))) |
|
|
|
|
;; Not Authorised |
|
|
|
|
(progn (utils:set-alert "You are not authorised to delete this archive entry.") |
|
|
|
|
(redirect "/login"))))))) |
|
|
|
|
|
|
|
|
|
(defroute ("/edit/archive" :method :POST) () |
|
|
|
|
(utils:set-alert "ROUTE NOT IMPLEMENTED") |
|
|
|
|