From 885c4ab9704ee75ede49c10e7a334f3ecc9c1ee6 Mon Sep 17 00:00:00 2001 From: Arne Brasseur Date: Tue, 20 Aug 2024 11:36:30 +0200 Subject: [PATCH] Tito connect ticket tweaks --- resources/logback.xml | 2 ++ src/co/gaiwan/compass/routes/ticket.clj | 26 +++++++++++++++---------- src/co/gaiwan/compass/services/tito.clj | 4 +++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/resources/logback.xml b/resources/logback.xml index 03ba110..8f688d9 100644 --- a/resources/logback.xml +++ b/resources/logback.xml @@ -13,4 +13,6 @@ + + diff --git a/src/co/gaiwan/compass/routes/ticket.clj b/src/co/gaiwan/compass/routes/ticket.clj index 2ee13c2..a84d212 100644 --- a/src/co/gaiwan/compass/routes/ticket.clj +++ b/src/co/gaiwan/compass/routes/ticket.clj @@ -10,16 +10,22 @@ (defn GET-connect-ticket-form [{:keys [identity] :as req}] - {:html/body - [:div - [:h2 "Ticket Connection"] - [:p "Connect your tito ticket to your compass account here by entering the reference code and your email address!"] - [:form {:method "post"} - [:label {:for "reference"} "The ticket reference code:"] [:br] - [:input {:type "text" :required true :name "reference" :maxlength 4 :placeholder "QUTU"}] [:br] - [:label {:for "email"} "The email address assigned to the ticket:"] [:br] - [:input {:type "email" :required true :name "email" :value (:discord/email identity)}] [:br] - [:input {:type "submit" :value "Connect"}]]]}) + (if-let [ticket (first (:tito.ticket/_assigned-to identity))] + {:html/body + [:div + [:h2 "Ticket Connection"] + [:p "Your ti.to ticket is already connected! You're all set!"] + [:p "Your ticket reference is " [:strong (:tito.ticket/reference ticket)] "."]]} + {:html/body + [:div + [:h2 "Ticket Connection"] + [:p "Connect your tito ticket to your compass account here by entering the reference code and your email address!"] + [:form {:method "post"} + [:label {:for "reference"} "The ticket reference code:"] [:br] + [:input {:type "text" :required true :name "reference" :maxlength 4 :placeholder "QUTU"}] [:br] + [:label {:for "email"} "The email address assigned to the ticket:"] [:br] + [:input {:type "email" :required true :name "email" :value (:discord/email identity)}] [:br] + [:input {:type "submit" :value "Connect"}]]]})) (defn POST-connect-ticket-form [{:keys [identity] diff --git a/src/co/gaiwan/compass/services/tito.clj b/src/co/gaiwan/compass/services/tito.clj index 5e04001..2f8cef3 100644 --- a/src/co/gaiwan/compass/services/tito.clj +++ b/src/co/gaiwan/compass/services/tito.clj @@ -128,7 +128,9 @@ [?ticket :tito.ticket/registration ?reg] [?ticket :tito.ticket/email ?email] (not [?ticket :tito.ticket/assigned-to _])] - (db/db) reference email)) + (db/db) + reference + email)) (defmethod ig/init-key :tito/sync [_ {:keys [interval-seconds]}] (log/info :tito/starting-sync-loop {:interval-seconds interval-seconds})