Repository: CSCfi/rems
Pull request #1189 (2019-04-30 13:29:58)

Upgrade React 16.3 -> 16.8
This makes it possible to use React's profiling tools. And anyways the version was about one year old.


Patch:
diff --git a/project.clj b/project.clj
index 9ab138166..e7616456a 100644
--- a/project.clj
+++ b/project.clj
@@ -9,6 +9,9 @@
                  [clj-pdf "2.3.1"]
                  [clj-time "0.15.1"]
                  [cljs-ajax "0.8.0"]
+                 [cljsjs/react "16.8.3-0"] ; overrides the old version used by Reagent
+                 [cljsjs/react-dom "16.8.3-0"]
+                 [cljsjs/react-dom-server "16.8.3-0"]
                  [com.andrewmcveigh/cljs-time "0.5.2"]
                  [com.attendify/schema-refined "0.3.0-alpha4"]
                  [com.draines/postal "2.0.3"]
diff --git a/resources/translations/en.edn b/resources/translations/en.edn
index 77105ed11..cd3329554 100644
--- a/resources/translations/en.edn
+++ b/resources/translations/en.edn
@@ -232,8 +232,6 @@
                                  :message "Dear %1,\nYour application %2 has been rejected.\nView your application: %3"}
           :application-closed {:subject "Your application has been closed"
                                :message "Dear %1,\nYour application %2 has been closed.\nView your application: %3"}
-          :application-submitted {:subject "A new application has been submitted"
-                                  :message "Dear %1,\nUser %2 has submitted a new application %3.\nView the application: %4"}
           :comment-requested {:subject "Comment request"
                               :message "Dear %1,\nUser %2 has requested your comment on application %3.\nComment here: %4"}
           :commented {:subject "New comment notification"
diff --git a/resources/translations/fi.edn b/resources/translations/fi.edn
index b95058140..79fd614ab 100644
--- a/resources/translations/fi.edn
+++ b/resources/translations/fi.edn
@@ -232,8 +232,6 @@
                                  :message "Hyvä %1,\nHakemuksesi %2 on hylätty.\nKatsele hakemusta: %3"}
           :application-closed {:subject "Hakemuksesi on suljettu"
                                :message "Hyvä %1,\nHakemuksesi %2 on suljettu.\nKatsele hakemusta: %3"}
-          :application-submitted {:subject "Uusi hakemus"
-                                  :message "Hyvä %1,\nKäyttäjä %2 on lähettänyt uuden hakemuksen %3.\nKatsele hakemusta: %4"}
           :comment-requested {:subject "Kommenttipyyntö"
                               :message "Hyvä %1,\nKäyttäjä %2 on pyytänyt sinulta kommenttia hakemukseen %3.\nKommentoi täällä: %4"}
           :commented {:subject "Uusi kommentti"
diff --git a/src/clj/rems/api/public.clj b/src/clj/rems/api/public.clj
index 70175bc8d..2a52c3481 100644
--- a/src/clj/rems/api/public.clj
+++ b/src/clj/rems/api/public.clj
@@ -51,11 +51,7 @@
       (ok (select-keys env [:authentication :alternative-login-url :application-id-column :extra-pages :languages :default-language :dev])))
 
     (GET "/full" []
-      :summary "Get (almost) full configuration"
+      :summary "Get full configuration"
       :roles #{:owner}
       :return s/Any
-      (ok (assoc env
-                 :authentication "HIDDEN"
-                 :database-url "HIDDEN"
-                 :ldap "HIDDEN"
-                 :test-database-url "HIDDEN")))))
+      (ok env))))
diff --git a/src/clj/rems/poller/email.clj b/src/clj/rems/poller/email.clj
index f0844bff1..2c482dbf0 100644
--- a/src/clj/rems/poller/email.clj
+++ b/src/clj/rems/poller/email.clj
@@ -35,19 +35,9 @@
 (defmethod event-to-emails-impl :default [_event _application]
   [])
 
-(defmethod event-to-emails-impl :application.event/submitted [_event application]
-  (vec
-   (for [handler (get-in application [:application/workflow :workflow.dynamic/handlers])]
-     {:to-user handler
-      :subject (text :t.email.application-submitted/subject)
-      :body (text-format :t.email.application-submitted/message
-                         handler
-                         (:application/applicant application)
-                         (application-id-for-email application)
-                         (link-to-application (:application/id application)))})))
-
 (defn- applicant-and-members [application]
-  (conj (:application/members application)
+  ;; XXX: the tests depend on the order of members
+  (conj (reverse (sort-by :userid (:application/members application)))
         {:userid (:application/applicant application)}))
 
 ;; There's a slight inconsistency here: we look at current members, so


Test patch:
diff --git a/test/clj/rems/poller/test_email.clj b/test/clj/rems/poller/test_email.clj
index 393512ce4..5e0e6ea92 100644
--- a/test/clj/rems/poller/test_email.clj
+++ b/test/clj/rems/poller/test_email.clj
@@ -16,14 +16,11 @@
     (f)
     (mount/stop)))
 
-(defn sort-emails [emails]
-  (sort-by #(or (:to %) (:to-user %)) emails))
-
 (defn events-to-emails [events]
   (let [application (-> (dynamic/apply-events nil events)
                         (model/enrich-workflow-handlers {5 {:workflow {:handlers ["handler" "assistant"]}}}))]
     (text/with-language :en
-      (fn [] (mapv #(sort-emails (#'rems.poller.email/event-to-emails-impl % application)) events)))))
+      (fn [] (mapv #(#'rems.poller.email/event-to-emails-impl % application) events)))))
 
 (deftest test-event-to-emails-impl
   (let [base-events [{:application/id 7
@@ -75,12 +72,7 @@
                     :event/type :application.event/closed
                     :event/actor "assistant"}])]
       (is (= [[]
-              [{:to-user "assistant",
-                :subject "A new application has been submitted",
-                :body "Dear assistant,\nUser applicant has submitted a new application 2001/3.\nView the application: http://localhost:3001/#/application/7"}
-               {:to-user "handler",
-                :subject "A new application has been submitted",
-                :body "Dear handler,\nUser applicant has submitted a new application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
+              []
               [{:to "somebody@example.com",
                 :subject "Invitation to participate in an application",
                 :body "Hello,\nThis email address (somebody@example.com) has been invited to participate in an application.\nParticipate with this link: http://localhost:3001/accept-invitation?token=abc"}]
@@ -91,54 +83,49 @@
                 :subject "Comment request",
                 :body "Dear commenter2,\nUser handler has requested your comment on application 2001/3.\nComment here: http://localhost:3001/#/application/7"}]
               []
-              [{:to-user "assistant",
+              [{:to-user "handler",
                 :subject "New comment notification",
-                :body "Dear assistant,\nUser commenter2 has posted a comment on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}
-               {:to-user "handler",
+                :body "Dear handler,\nUser commenter2 has posted a comment on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}
+               {:to-user "assistant",
                 :subject "New comment notification",
-                :body "Dear handler,\nUser commenter2 has posted a comment on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
+                :body "Dear assistant,\nUser commenter2 has posted a comment on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
               [{:to-user "member",
                 :subject "You've been added as a member to an application",
                 :body "Dear member,\nYou've been added as a member to application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
               [{:to-user "decider",
                 :subject "Decision request",
                 :body "Dear decider,\nUser assistant has requested your decision on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
-              [{:to-user "assistant",
+              [{:to-user "handler",
                 :subject "New decision notification",
-                :body "Dear assistant,\nUser decider has sent a decision on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}
-               {:to-user "handler",
+                :body "Dear handler,\nUser decider has sent a decision on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}
+               {:to-user "assistant",
                 :subject "New decision notification",
-                :body "Dear handler,\nUser decider has sent a decision on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
+                :body "Dear assistant,\nUser decider has sent a decision on application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
               [{:to-user "applicant",
                 :subject "Your application has been approved",
                 :body "Dear applicant,\nYour application 2001/3 has been approved.\nView your application: http://localhost:3001/#/application/7"}
-               {:to-user "member",
-                :subject "Your application has been approved",
-                :body "Dear member,\nYour application 2001/3 has been approved.\nView your application: http://localhost:3001/#/application/7"}
                {:to-user "somebody",
                 :subject "Your application has been approved",
-                :body "Dear somebody,\nYour application 2001/3 has been approved.\nView your application: http://localhost:3001/#/application/7"}]
+                :body "Dear somebody,\nYour application 2001/3 has been approved.\nView your application: http://localhost:3001/#/application/7"}
+               {:to-user "member",
+                :subject "Your application has been approved",
+                :body "Dear member,\nYour application 2001/3 has been approved.\nView your application: http://localhost:3001/#/application/7"}]
               [{:to-user "applicant",
                 :subject "Your application has been closed",
                 :body "Dear applicant,\nYour application 2001/3 has been closed.\nView your application: http://localhost:3001/#/application/7"}
-               {:to-user "member",
-                :subject "Your application has been closed",
-                :body "Dear member,\nYour application 2001/3 has been closed.\nView your application: http://localhost:3001/#/application/7"}
                {:to-user "somebody",
                 :subject "Your application has been closed",
-                :body "Dear somebody,\nYour application 2001/3 has been closed.\nView your application: http://localhost:3001/#/application/7"}]]
+                :body "Dear somebody,\nYour application 2001/3 has been closed.\nView your application: http://localhost:3001/#/application/7"}
+               {:to-user "member",
+                :subject "Your application has been closed",
+                :body "Dear member,\nYour application 2001/3 has been closed.\nView your application: http://localhost:3001/#/application/7"}]]
              (events-to-emails events))))
     (let [events (conj base-events
                        {:application/id 7
                         :event/type :application.event/rejected
                         :event/actor "handler"})]
       (is (= [[]
-              [{:to-user "assistant",
-                :subject "A new application has been submitted",
-                :body "Dear assistant,\nUser applicant has submitted a new application 2001/3.\nView the application: http://localhost:3001/#/application/7"}
-               {:to-user "handler",
-                :subject "A new application has been submitted",
-                :body "Dear handler,\nUser applicant has submitted a new application 2001/3.\nView the application: http://localhost:3001/#/application/7"}]
+              []
               [{:subject "Your application has been rejected",
                 :body "Dear applicant,\nYour application 2001/3 has been rejected.\nView your application: http://localhost:3001/#/application/7",
                 :to-user "applicant"}]]