From a90b868136e21f3af07f39eaf63439c619d73d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 15 Jul 2020 00:38:07 +0200 Subject: HTML Generated events now come without an UID. --- module/entry-points/server.scm | 6 ++++++ module/output/html.scm | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'module') diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm index 64204b9d..78950b24 100644 --- a/module/entry-points/server.scm +++ b/module/entry-points/server.scm @@ -170,6 +170,12 @@ (return (build-response code: 400) "Object not a VEVENT\r\n")) + ;; NOTE add-event uses the given UID if one is given, + ;; but generates its own if not. It might be a good idea + ;; to require that UID is unset here, and force users + ;; to use a /update endpoint to change events. This to prevent + ;; accidental overwriting. + (parameterize ((warnings-are-errors #t)) (catch 'warning (lambda () (add-event calendar event)) diff --git a/module/output/html.scm b/module/output/html.scm index 56606719..acc93c0e 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -221,9 +221,10 @@ (inner x (right-subtree tree)))))) (define* (make-block ev optional: (extra-attributes '()) - key: (popup-id (symbol->string (gensym "popup")))) + key: element-id + (popup-id (symbol->string (gensym "popup")))) - `((a (@ (href "#" ,(html-id ev)) + `((a (@ (href "#" ,(or element-id (html-id ev))) (class "hidelink")) (div (@ ,@(assq-merge extra-attributes @@ -835,7 +836,10 @@ ,(let ((cal (vcalendar name: "Generated" children: (list (vevent - uid: (uuidgen) + ;; The event template SHOULD lack + ;; a UID, to stop potential problems + ;; with conflicts when multiple it's + ;; cloned mulitple times. dtstart: (datetime) dtend: (datetime) summary: "New Event"))))) @@ -846,7 +850,8 @@ ;; full width. Adding this however completely breaks ;; creation of long events. ;; (style "width:calc(100%*var(--editmode));") - )))))))))) + ) + element-id: "GENERATED"))))))))) -- cgit v1.2.3