Browse Source

add 'Search' as hard-coded URL in '/' and update delete Arch. Entry.

The re-direct to /search when the user has set /search as the site's home page
is part of a list of other hard-coded re-directs in this site's '/' defroute.

The site now deletes the Archive Entry from the Meilisearch database alongside
the files in the /storage directory and the nera database.
stable
Craig Oates 2 years ago
parent
commit
e90de5e31a
  1. 23
      src/web.lisp

23
src/web.lisp

@ -43,6 +43,8 @@
(redirect "/login")) (redirect "/login"))
((string= "pages" (site-settings::home-page-of (nera:get-site-settings))) ((string= "pages" (site-settings::home-page-of (nera:get-site-settings)))
(redirect "/pages")) (redirect "/pages"))
((string= "search" (site-settings::home-page-of (nera:get-site-settings)))
(redirect "/search"))
((string= "sign-up" (site-settings::home-page-of (nera:get-site-settings))) ((string= "sign-up" (site-settings::home-page-of (nera:get-site-settings)))
(redirect "/sign-up")) (redirect "/sign-up"))
(t (render #P"index.html" (t (render #P"index.html"
@ -1331,18 +1333,23 @@
(null (nera:get-archive-entry :slug slug))) (null (nera:get-archive-entry :slug slug)))
(utils:set-alert "Couldn't find archive entry in database. Deleted files only." (utils:set-alert "Couldn't find archive entry in database. Deleted files only."
"invalid-data") "invalid-data")
;; The thumbnail in not know because it was linked to the ;; The thumbnail in not know about here because it was
;; text file via the database. You will need to delete the ;; linked to the text file via the database. You will need
;; thumbnail manually at this point but the system has ;; to delete the thumbnail manually at this point but the
;; already failed here anyway so the extra work was already ;; system has already failed here anyway so the extra work
;; needed. ;; was already needed.
(storage:remove-file "" "archive" slug) (storage:remove-file "" "archive" slug)
(redirect "/user/archive")) (redirect "/user/archive"))
(t (storage:remove-file "" "archive" slug) (t (storage:remove-file "" "archive" slug) ; Archive Entry
;; Archive Entry Thumbnail
(storage:remove-file (storage:remove-file
"" "archive" "" "archive" (archive::thumbnail-slug-of
(archive::thumbnail-slug-of (nera:get-archive-entry :slug slug))) (nera:get-archive-entry :slug slug)))
;; Meilisearch DB Entry
(search:delete-entry
(archive::search-id-of (nera:get-archive-entry :slug slug)))
;; DB Entry
(nera:delete-archive-entry :slug slug) (nera:delete-archive-entry :slug slug)
(utils:set-alert "Archive entry deleted." "success") (utils:set-alert "Archive entry deleted." "success")
(redirect "/user/archive"))) (redirect "/user/archive")))

Loading…
Cancel
Save