Repository: CSCfi/rems
Pull request #1650 (2019-09-20 07:57:39)

Change event descriptions on application page
Related to #1634 

# Definition of Done / Review checklist

## Reviewability
- [x] link to issue

## Documentation
- [x] update changelog if necessary



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 014989e8f..b8e17e872 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -79,6 +79,7 @@ Changes since v2.4
 - Show three latest events as a default on the application page (#1632)
 - A change of language persists now after login thanks to a new language setting cookie.
 - A returning user will see the login screen in the correct language if he or she has the cookie.
+- Event descriptions on application page now use full name and are more thorough (#1634)
 
 ### Fixes
 - Entitlement API
diff --git a/resources/translations/en.edn b/resources/translations/en.edn
index 73e8b23f5..fad0e0b05 100644
--- a/resources/translations/en.edn
+++ b/resources/translations/en.edn
@@ -12,7 +12,7 @@
             :cancel "Cancel"
             :close "Close application"
             :close-intro [:div.intro [:p "Note that if the application is closed, it cannot be opened again."]]
-            :comment-placeholder "Comment"
+            :comment "Comment"
             :decide "Decide"
             :empty "No applications to process."
             :errors {:disabled-catalogue-item "Resource no longer available."
@@ -111,29 +111,29 @@
                  ;;   code to match the term in UI.
                  :description "Title"
                  :empty "No applications."
-                 :events {:approved "Approved"
-                          :closed "Closed"
-                          :comment-requested "Review requested"
-                          :commented "Reviewed"
-                          :copied-from "Copied from an old application"
-                          :copied-to "Copied to a new application"
-                          :created "Created"
-                          :decided "Decided"
-                          :decision-requested "Decision requested"
-                          :draft-saved "Saved"
-                          :licenses-accepted "Accepted terms of use"
-                          :licenses-added "Added terms of use"
-                          :member-added "Member added"
-                          :member-invited "Member invited"
-                          :member-joined "Member joined"
-                          :member-removed "Member removed"
-                          :member-uninvited "Member uninvited"
-                          :rejected "Rejected"
-                          :remarked "Remarked"
-                          :resources-changed "Resources changed"
-                          :returned "Changes requested"
-                          :revoked "Revoked"
-                          :submitted "Applied"
+                 :events {:approved "%1 approved the application."
+                          :closed "%1 closed the application."
+                          :comment-requested "%1 requested a review from %2."
+                          :commented "%1 reviewed the application."
+                          :copied-from "%1 copied the application from an old application."
+                          :copied-to "%1 copied the application to a new application."
+                          :created "%1 created a new application."
+                          :decision-requested "%1 requested a decision from %2."
+                          :decided "%1 filed a decision for the application."
+                          :draft-saved "%1 saved the application as a draft."
+                          :licenses-accepted "%1 accepted the terms of use."
+                          :licenses-added "%1 added terms of use."
+                          :member-added "%1 added %2 to the application."
+                          :member-invited "%1 invited %2 to the application."
+                          :member-joined "%1 joined to the application."
+                          :member-removed "%1 removed %2 from the application."
+                          :member-uninvited "%1 removed %2 from the application."
+                          :rejected "%1 rejected the application."
+                          :remarked "%1 added a remark."
+                          :resources-changed "%1 changed the resources. New resources: %2."
+                          :returned "%1 requested changes to the application."
+                          :revoked "%1 revoked the application."
+                          :submitted "%1 submitted the application for review."
                           :unknown "Unknown"}
                  :id "Id"
                  :intro [:div.intro [:p "By filling and sending in this application, the applicants may be granted the applied resources. All the applicable terms of use must also be accepted by each applicant."]]
diff --git a/resources/translations/fi.edn b/resources/translations/fi.edn
index ea6fb80cc..be8ef3a1d 100644
--- a/resources/translations/fi.edn
+++ b/resources/translations/fi.edn
@@ -12,7 +12,7 @@
             :cancel "Peruuta"
             :close "Sulje hakemus"
             :close-intro [:div.intro [:p "Huomaa, että jos hakemus suljetaan, sitä ei voida avata uudelleen."]]
-            :comment-placeholder "Kommentti"
+            :comment "Kommentti"
             :decide "Päätä"
             :empty "Ei käsiteltäviä hakemuksia."
             :errors {:disabled-catalogue-item "Resurssit eivät ole enää saatavilla."
@@ -109,29 +109,29 @@
                  :created "Luotu"
                  :description "Otsikko"
                  :empty "Ei hakemuksia."
-                 :events {:approved "Hyväksytty"
-                          :closed "Suljettu"
-                          :comment-requested "Katselmointia pyydetty"
-                          :commented "Katselmoitu"
-                          :copied-from "Kopioitu vanhasta hakemuksesta"
-                          :copied-to "Kopioitu uudeksi hakemukseksi"
-                          :created "Luotu"
-                          :decided "Päätetty"
-                          :decision-requested "Päätöstä pyydetty"
-                          :draft-saved "Tallennettu"
-                          :licenses-accepted "Käyttöehdot hyväksytty"
-                          :licenses-added "Käyttöehtoja lisätty"
-                          :member-added "Jäsen lisätty"
-                          :member-invited "Jäsen kutsuttu"
-                          :member-joined "Jäsen liittyi"
-                          :member-removed "Jäsen poistettu"
-                          :member-uninvited "Jäsen poistettu"
-                          :rejected "Hylätty"
-                          :remarked "Huomio kirjattu"
-                          :resources-changed "Resursseja muutettu"
-                          :returned "Palautettu muokattavaksi"
-                          :revoked "Peruttu"
-                          :submitted "Haettu"
+                 :events {:approved "%1 hyväksyi hakemuksen."
+                          :closed "%1 sulki hakemuksen."
+                          :comment-requested "%1 pyysi katselmointia käyttäjältä %2."
+                          :commented "%1 katselmoi hakemuksen."
+                          :copied-from "%1 kopioi hakemuksen vanhasta hakemuksesta."
+                          :copied-to "%1 kopioi hakemuksen uudeksi hakemukseksi."
+                          :created "%1 loi uuden hakemuksen."
+                          :decision-requested "%1 pyysi päätöstä käyttäjältä %2."
+                          :decided "%1 teki päätöksen hakemukselle."
+                          :draft-saved "%1 tallensi hakemuksen luonnoksen."
+                          :licenses-accepted "%1 hyväksyi käyttöehdot."
+                          :licenses-added "%1 lisäsi käyttöehtoja."
+                          :member-added "%1 lisäsi käyttäjän %2 hakemuksen jäseneksi."
+                          :member-invited "%1 kutsui henkilön %2 hakemuksen jäseneksi."
+                          :member-joined "Henkilö %1 liittyi hakemuksen jäseneksi."
+                          :member-removed "%1 poisti hakemuksesta käyttäjän %2."
+                          :member-uninvited "%1 poisti hakemuksesta henkilön %2."
+                          :rejected "%1 hylkäsi hakemuksen."
+                          :remarked "%1 kirjasi huomion."
+                          :resources-changed "%1 muutti haettavia resursseja. Uudet resurssit: %2."
+                          :returned "%1 palautti hakemuksen muokattavaksi."
+                          :revoked "%1 perui hakemuksen."
+                          :submitted "%1 lähetti hakemuksen käsiteltäväksi."
                           :unknown "Tuntematon"}
                  :id "Tunniste"
                  :intro [:div.intro [:p "Täyttämällä ja lähettämällä tämän hakemuksen kaikki hakijat voivat saada oikeuden haettuihin resursseihin. Kunkin hakijan on lisäksi hyväksyttävä käyttöehdot viimeistään hakemuksen käsittelyn jälkeen."]]
diff --git a/src/clj/rems/application/model.clj b/src/clj/rems/application/model.clj
index 3bfa02418..232c04993 100644
--- a/src/clj/rems/application/model.clj
+++ b/src/clj/rems/application/model.clj
@@ -475,8 +475,8 @@
                          :field/value)]
     (assoc application :application/description (str description))))
 
-(defn- enrich-resources [app-resources get-catalogue-item]
-  (->> app-resources
+(defn- enrich-resources [resources get-catalogue-item]
+  (->> resources
        (map (fn [resource]
               (let [item (get-catalogue-item (:catalogue-item/id resource))]
                 {:catalogue-item/id (:catalogue-item/id resource)
@@ -514,6 +514,28 @@
                            (sort-by :license/id))]
     (merge-lists-by :license/id rich-licenses app-licenses)))
 
+(defn- enrich-events [events get-user get-catalogue-item]
+  (->> events
+       (map (fn [event]
+              (let [event-type (:event/type event)]
+                (merge event
+                       {:event/actor-attributes (get-user (:event/actor event))}
+                       (case event-type
+                         :application.event/resources-changed
+                         {:application/resources (enrich-resources (:application/resources event) get-catalogue-item)}
+
+                         :application.event/decision-requested
+                         {:application/deciders (mapv get-user (:application/deciders event))}
+
+                         :application.event/comment-requested
+                         {:application/commenters (mapv get-user (:application/commenters event))}
+
+                         (:application.event/member-added
+                          :application.event/member-removed)
+                         {:application/member (get-user (:userid (:application/member event)))}
+
+                         {})))))))
+
 (defn- enrich-user-attributes [application get-user]
   (letfn [(enrich-members [members]
             (->> members
@@ -561,6 +583,7 @@
         set-application-description
         (update :application/resources enrich-resources get-catalogue-item)
         (update :application/licenses enrich-licenses get-license)
+        (update :application/events enrich-events get-user get-catalogue-item)
         (assoc :application/applicant-attributes (get-user (:application/applicant application)))
         (assoc :application/attachments (get-attachments-for-application (getx application :application/id)))
         (enrich-user-attributes get-user)
diff --git a/src/cljc/rems/text.cljc b/src/cljc/rems/text.cljc
index fa8edc37a..3669346cf 100644
--- a/src/cljc/rems/text.cljc
+++ b/src/cljc/rems/text.cljc
@@ -1,12 +1,16 @@
 (ns rems.text
   #?(:clj (:require [clj-time.core :as time]
                     [clj-time.format :as format]
+                    [clojure.string :as str]
+                    [rems.application-util :as application-util]
                     [rems.context :as context]
                     [rems.locales :as locales]
                     [taoensso.tempura :refer [tr]])
      :cljs (:require [cljs-time.core :as time]
                      [cljs-time.format :as format]
+                     [clojure.string :as str]
                      [re-frame.core :as rf]
+                     [rems.application-util :as application-util]
                      [taoensso.tempura :refer [tr]])))
 
 (defn with-language [lang f]
@@ -110,14 +114,40 @@
    :application.event/revoked :t.applications.events/revoked
    :application.event/submitted :t.applications.events/submitted})
 
-(defn localize-event [event-type]
-  (text (get event-types event-type :t.applications.events/unknown)))
+(defn localize-decision [event]
+  (let [decision (:application/decision event)]
+    (text-format
+     (case decision
+       :approved :t.applications.events/approved
+       :rejected :t.applications.events/rejected
+       :t.applications.events/unknown)
+     (application-util/get-member-name (:event/actor-attributes event)))))
 
-(defn localize-decision [decision]
-  (text (case decision
-          :approved :t.applications.events/approved
-          :rejected :t.applications.events/rejected
-          :t.applications.events/unknown)))
+(defn localize-event [event]
+  (let [event-type (:event/type event)]
+    (text-format
+     (get event-types event-type :t.applications.events/unknown)
+     (application-util/get-member-name (:event/actor-attributes event))
+     (case event-type
+       :application.event/comment-requested
+       (str/join ", " (mapv application-util/get-member-name
+                            (:application/commenters event)))
+
+       :application.event/decision-requested
+       (str/join ", " (mapv application-util/get-member-name
+                            (:application/deciders event)))
+
+       (:application.event/member-added
+        :application.event/member-invited
+        :application.event/member-removed
+        :application.event/member-uninvited)
+       (application-util/get-member-name (:application/member event))
+
+       :application.event/resources-changed
+       (str/join ", " (mapv #(localized (:catalogue-item/title %))
+                            (:application/resources event)))
+
+       nil))))
 
 (def ^:private time-format
   (format/formatter "yyyy-MM-dd HH:mm" (time/default-time-zone)))
diff --git a/src/cljs/rems/actions/action.cljs b/src/cljs/rems/actions/action.cljs
index 8cf323590..d87b9ed9f 100644
--- a/src/cljs/rems/actions/action.cljs
+++ b/src/cljs/rems/actions/action.cljs
@@ -35,7 +35,7 @@
                 :min-rows 4
                 :max-rows 4
                 :name id
-                :placeholder (text :t.actions/comment-placeholder)
+                :placeholder (text :t.actions/comment)
                 :value comment
                 :on-change #(on-comment (.. % -target -value))}]]))
 
diff --git a/src/cljs/rems/application.cljs b/src/cljs/rems/application.cljs
index e7d91e765..bb4b2d32c 100644
--- a/src/cljs/rems/application.cljs
+++ b/src/cljs/rems/application.cljs
@@ -382,32 +382,32 @@
      (application-list/format-application-id config application)]))
 
 (defn- format-event [event]
-  {:userid (:event/actor event)
-   :event (localize-event (:event/type event))
+  {:user (:commonName (:event/actor-attributes event))
+   :event (localize-event event)
+   :decision (when (= (:event/type event) :application.event/decided)
+               (localize-decision event))
    :comment (case (:event/type event)
-              :application.event/decided
-              (str (localize-decision (:application/decision event)) ": " (:application/comment event))
-
               :application.event/copied-from
               [application-link (:application/copied-from event) (text :t.applications/application)]
 
               :application.event/copied-to
               [application-link (:application/copied-to event) (text :t.applications/application)]
 
-              (:application/comment event))
+              (let [comment (:application/comment event)]
+                (when (not (empty? comment))
+                  (str (text :t.actions/comment) ": " (:application/comment event)))))
    :request-id (:application/request-id event)
-   :commenters (:application/commenters event)
-   :deciders (:application/deciders event)
    :time (localize-time (:event/time event))})
 
-(defn- event-view [{:keys [time userid event comment commenters deciders]}]
+(defn- event-view [{:keys [time user event comment decision]}]
   [:div.row
    [:label.col-sm-2.col-form-label time]
    [:div.col-sm-10
-    [:div.col-form-label [:span userid] " — " [:span event]
-     (when-let [targets (seq (concat commenters deciders))]
-       [:span ": " (str/join ", " targets)])]
-    (when comment [:div comment])]])
+    [:div.col-form-label event]
+    (when decision
+      [:div decision])
+    (when comment
+      [:div comment])]])
 
 (defn- render-event-groups [event-groups]
   (for [group event-groups]


Test patch:
diff --git a/test/clj/rems/application/test_model.clj b/test/clj/rems/application/test_model.clj
index 8f31fef94..b0e11c971 100644
--- a/test/clj/rems/application/test_model.clj
+++ b/test/clj/rems/application/test_model.clj
@@ -140,7 +140,19 @@
 (def ^:private get-user
   {"applicant" {:eppn "applicant"
                 :mail "applicant@example.com"
-                :commonName "Applicant"}})
+                :commonName "Applicant"}
+   "commenter" {:eppn "commenter"
+                :mail "commenter@example.com"
+                :commonName "Commenter"}
+   "decider" {:eppn "decider"
+              :mail "decider@example.com"
+              :commonName "Decider"}
+   "handler" {:eppn "handler"
+              :mail "handler@example.com"
+              :commonName "Handler"}
+   "member" {:eppn "member"
+             :mail "member@example.com"
+             :commonName "Member"}})
 
 (def ^:private get-users-with-role
   {:owner ["owner1"]
@@ -163,6 +175,46 @@
        :archived false
        :expired false}})
 
+(def ^:private resource-id-11
+  {:resource/id 11
+   :resource/ext-id "urn:11"
+   :catalogue-item/id 10
+   :catalogue-item/title {:en "en title"
+                          :fi "fi title"}
+   :catalogue-item/infourl {:en "http://info.com"}
+   :catalogue-item/start (DateTime. 100)
+   :catalogue-item/end nil
+   :catalogue-item/enabled true
+   :catalogue-item/expired false
+   :catalogue-item/archived false})
+
+(def ^:private resource-id-21
+  {:resource/id 21
+   :resource/ext-id "urn:21"
+   :catalogue-item/id 20
+   :catalogue-item/title {:en "en title"
+                          :fi "fi title"}
+   :catalogue-item/infourl {:en "http://info.com"}
+   :catalogue-item/start (DateTime. 100)
+   :catalogue-item/end nil
+   :catalogue-item/enabled true
+   :catalogue-item/expired false
+   :catalogue-item/archived false})
+
+(def ^:private resource-id-31
+  {:catalogue-item/end nil
+   :catalogue-item/expired false
+   :catalogue-item/enabled true
+   :resource/id 31
+   :catalogue-item/title
+   {:en "en title", :fi "fi title"}
+   :catalogue-item/infourl
+   {:en "http://info.com"}
+   :resource/ext-id "urn:31"
+   :catalogue-item/start (DateTime. 100)
+   :catalogue-item/archived false
+   :catalogue-item/id 30})
+
 ;; no attachments here for now
 (defn ^:private get-attachments-for-application [id]
   [])
@@ -191,23 +243,24 @@
                                              permissions/cleanup)]
                          (is (contains? model/states (:application/state application)))
                          application))]
-
     (testing "created"
-      (let [events [{:event/type :application.event/created
-                     :event/time (DateTime. 1000)
-                     :event/actor "applicant"
-                     :application/id 1
-                     :application/external-id "extid"
-                     :application/resources [{:catalogue-item/id 10
-                                              :resource/ext-id "urn:11"}
-                                             {:catalogue-item/id 20
-                                              :resource/ext-id "urn:21"}]
-                     :application/licenses [{:license/id 30}
-                                            {:license/id 31}
-                                            {:license/id 32}]
-                     :form/id 40
-                     :workflow/id 50
-                     :workflow/type :workflow/dynamic}]
+      (let [new-event {:event/type :application.event/created
+                       :event/time (DateTime. 1000)
+                       :event/actor "applicant"
+                       :application/id 1
+                       :application/external-id "extid"
+                       :application/resources [{:catalogue-item/id 10
+                                                :resource/ext-id "urn:11"}
+                                               {:catalogue-item/id 20
+                                                :resource/ext-id "urn:21"}]
+                       :application/licenses [{:license/id 30}
+                                              {:license/id 31}
+                                              {:license/id 32}]
+                       :form/id 40
+                       :workflow/id 50
+                       :workflow/type :workflow/dynamic}
+            events [new-event]
+            enriched-events [(assoc new-event :event/actor-attributes (get-user "applicant"))]
             expected-application {:application/id 1
                                   :application/external-id "extid"
                                   :application/state :application.state/draft
@@ -272,7 +325,7 @@
                                                           :license/enabled true
                                                           :license/archived false}]
                                   :application/accepted-licenses {}
-                                  :application/events events
+                                  :application/events enriched-events
                                   :application/description ""
                                   :application/form {:form/id 40
                                                      :form/title "form title"
@@ -299,16 +352,18 @@
         (is (= expected-application (apply-events events)))
 
         (testing "> draft saved"
-          (let [events (conj events {:event/type :application.event/draft-saved
-                                     :event/time (DateTime. 2000)
-                                     :event/actor "applicant"
-                                     :application/id 1
-                                     :application/field-values {41 "foo"
-                                                                42 "bar"}})
+          (let [new-event {:event/type :application.event/draft-saved
+                           :event/time (DateTime. 2000)
+                           :event/actor "applicant"
+                           :application/id 1
+                           :application/field-values {41 "foo"
+                                                      42 "bar"}}
+                events (conj events new-event)
+                enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                 expected-application (deep-merge expected-application
                                                  {:application/modified (DateTime. 2000)
                                                   :application/last-activity (DateTime. 2000)
-                                                  :application/events events
+                                                  :application/events enriched-events
                                                   :application/description "foo"
                                                   :application/accepted-licenses {}
                                                   :application/form {:form/fields [{:field/value "foo"}
@@ -316,15 +371,17 @@
             (is (= expected-application (apply-events events)))
 
             (testing "> copied from"
-              (let [events (conj events {:event/type :application.event/copied-from
-                                         :event/time (DateTime. 3000)
-                                         :event/actor "applicant"
-                                         :application/id 1
-                                         :application/copied-from {:application/id 42
-                                                                   :application/external-id "2019/42"}})
+              (let [new-event {:event/type :application.event/copied-from
+                               :event/time (DateTime. 3000)
+                               :event/actor "applicant"
+                               :application/id 1
+                               :application/copied-from {:application/id 42
+                                                         :application/external-id "2019/42"}}
+                    events (conj events new-event)
+                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                     expected-application (deep-merge expected-application
                                                      {:application/last-activity (DateTime. 3000)
-                                                      :application/events events
+                                                      :application/events enriched-events
                                                       :application/copied-from {:application/id 42
                                                                                 :application/external-id "2019/42"}
                                                       :application/form {:form/fields [{:field/previous-value "foo"}
@@ -332,23 +389,26 @@
                 (is (= expected-application (apply-events events)))))
 
             (testing "> copied to"
-              (let [events (conj events
-                                 ;; two copied-to events in order to test the order in which they are shown
-                                 {:event/type :application.event/copied-to
-                                  :event/time (DateTime. 3000)
-                                  :event/actor "applicant"
-                                  :application/id 1
-                                  :application/copied-to {:application/id 666
-                                                          :application/external-id "2020/666"}}
-                                 {:event/type :application.event/copied-to
-                                  :event/time (DateTime. 3000)
-                                  :event/actor "applicant"
-                                  :application/id 1
-                                  :application/copied-to {:application/id 777
-                                                          :application/external-id "2021/777"}})
+              (let [;; two copied-to events in order to test the order in which they are shown
+                    new-event-1 {:event/type :application.event/copied-to
+                                 :event/time (DateTime. 3000)
+                                 :event/actor "applicant"
+                                 :application/id 1
+                                 :application/copied-to {:application/id 666
+                                                         :application/external-id "2020/666"}}
+                    new-event-2 {:event/type :application.event/copied-to
+                                 :event/time (DateTime. 3000)
+                                 :event/actor "applicant"
+                                 :application/id 1
+                                 :application/copied-to {:application/id 777
+                                                         :application/external-id "2021/777"}}
+                    events (conj events new-event-1 new-event-2)
+                    enriched-events (conj enriched-events
+                                          (assoc new-event-1 :event/actor-attributes (get-user "applicant"))
+                                          (assoc new-event-2 :event/actor-attributes (get-user "applicant")))
                     expected-application (deep-merge expected-application
                                                      {:application/last-activity (DateTime. 3000)
-                                                      :application/events events
+                                                      :application/events enriched-events
                                                       :application/copied-to [{:application/id 666
                                                                                :application/external-id "2020/666"}
                                                                               {:application/id 777
@@ -356,34 +416,43 @@
                 (is (= expected-application (apply-events events)))))
 
             (testing "> accepted licenses"
-              (let [events (conj events {:event/type :application.event/licenses-accepted
-                                         :event/time (DateTime. 2500)
-                                         :event/actor "applicant"
-                                         :application/id 1
-                                         :application/accepted-licenses #{30 31 32}})
+              (let [new-event {:event/type :application.event/licenses-accepted
+                               :event/time (DateTime. 2500)
+                               :event/actor "applicant"
+                               :application/id 1
+                               :application/accepted-licenses #{30 31 32}}
+                    events (conj events new-event)
+                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                     expected-application (deep-merge expected-application
                                                      {:application/last-activity (DateTime. 2500)
-                                                      :application/events events
+                                                      :application/events enriched-events
                                                       :application/accepted-licenses {"applicant" #{30 31 32}}})]
                 (is (= expected-application (apply-events events)))
 
                 (testing "> resources changed by applicant"
-                  (let [events (conj events
-                                     {:event/type :application.event/resources-changed
-                                      :event/time (DateTime. 2600)
-                                      :event/actor "applicant"
-                                      :application/id 1
-                                      :application/resources [{:catalogue-item/id 10 :resource/ext-id "urn:11"}
-                                                              {:catalogue-item/id 20 :resource/ext-id "urn:21"}
-                                                              {:catalogue-item/id 30 :resource/ext-id "urn:31"}]
-                                      :application/licenses [{:license/id 30}
-                                                             {:license/id 31}
-                                                             {:license/id 32}
-                                                             {:license/id 34}]})
+                  (let [new-event {:event/type :application.event/resources-changed
+                                   :event/time (DateTime. 2600)
+                                   :event/actor "applicant"
+                                   :application/id 1
+                                   :application/resources [{:catalogue-item/id 10 :resource/ext-id "urn:11"}
+                                                           {:catalogue-item/id 20 :resource/ext-id "urn:21"}
+                                                           {:catalogue-item/id 30 :resource/ext-id "urn:31"}]
+                                   :application/licenses [{:license/id 30}
+                                                          {:license/id 31}
+                                                          {:license/id 32}
+                                                          {:license/id 34}]}
+                        events (conj events new-event)
+                        enriched-events
+                        (conj enriched-events (merge new-event
+                                                     {:event/actor-attributes (get-user "applicant")
+                                                      :application/resources
+                                                      [resource-id-11
+                                                       resource-id-21
+                                                       resource-id-31]}))
                         expected-application (deep-merge expected-application
                                                          {:application/last-activity (DateTime. 2600)
                                                           :application/modified (DateTime. 2600)
-                                                          :application/events events
+                                                          :application/events enriched-events
                                                           :application/resources (conj (:application/resources expected-application)
                                                                                        {:catalogue-item/id 30
                                                                                         :resource/id 31
@@ -410,27 +479,31 @@
                     (is (= expected-application (apply-events events)))))
 
                 (testing "> submitted"
-                  (let [events (conj events {:event/type :application.event/submitted
-                                             :event/time (DateTime. 3000)
-                                             :event/actor "applicant"
-                                             :application/id 1})
+                  (let [new-event {:event/type :application.event/submitted
+                                   :event/time (DateTime. 3000)
+                                   :event/actor "applicant"
+                                   :application/id 1}
+                        events (conj events new-event)
+                        enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                         expected-application (merge expected-application
                                                     {:application/last-activity (DateTime. 3000)
-                                                     :application/events events
+                                                     :application/events enriched-events
                                                      :application/first-submitted (DateTime. 3000)
                                                      :application/state :application.state/submitted
                                                      :application/todo :new-application})]
                     (is (= expected-application (apply-events events)))
 
                     (testing "> returned"
-                      (let [events (conj events {:event/type :application.event/returned
-                                                 :event/time (DateTime. 4000)
-                                                 :event/actor "handler"
-                                                 :application/id 1
-                                                 :application/comment "fix stuff"})
+                      (let [new-event {:event/type :application.event/returned
+                                       :event/time (DateTime. 4000)
+                                       :event/actor "handler"
+                                       :application/id 1
+                                       :application/comment "fix stuff"}
+                            events (conj events new-event)
+                            enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "handler")))
                             expected-application (deep-merge expected-application
                                                              {:application/last-activity (DateTime. 4000)
-                                                              :application/events events
+                                                              :application/events enriched-events
                                                               :application/state :application.state/returned
                                                               :application/todo nil
                                                               :application/form {:form/fields [{:field/previous-value "foo"}
@@ -438,24 +511,27 @@
                         (is (= expected-application (apply-events events)))
 
                         (testing "> draft saved x2"
-                          (let [events (conj events
-                                             {:event/type :application.event/draft-saved
-                                              :event/time (DateTime. 5000)
-                                              :event/actor "applicant"
-                                              :application/id 1
-                                              ;; non-submitted versions should not show up as the previous value
-                                              :application/field-values {41 "intermediate draft"
-                                                                         42 "intermediate draft"}}
-                                             {:event/type :application.event/draft-saved
-                                              :event/time (DateTime. 6000)
-                                              :event/actor "applicant"
-                                              :application/id 1
-                                              :application/field-values {41 "new foo"
-                                                                         42 "new bar"}})
+                          (let [new-event-1 {:event/type :application.event/draft-saved
+                                             :event/time (DateTime. 5000)
+                                             :event/actor "applicant"
+                                             :application/id 1
+                                             ;; non-submitted versions should not show up as the previous value
+                                             :application/field-values {41 "intermediate draft"
+                                                                        42 "intermediate draft"}}
+                                new-event-2 {:event/type :application.event/draft-saved
+                                             :event/time (DateTime. 6000)
+                                             :event/actor "applicant"
+                                             :application/id 1
+                                             :application/field-values {41 "new foo"
+                                                                        42 "new bar"}}
+                                events (conj events new-event-1 new-event-2)
+                                enriched-events (conj enriched-events
+                                                      (assoc new-event-1 :event/actor-attributes (get-user "applicant"))
+                                                      (assoc new-event-2 :event/actor-attributes (get-user "applicant")))
                                 expected-application (deep-merge expected-application
                                                                  {:application/modified (DateTime. 6000)
                                                                   :application/last-activity (DateTime. 6000)
-                                                                  :application/events events
+                                                                  :application/events enriched-events
                                                                   :application/description "new foo"
                                                                   :application/form {:form/fields [{:field/value "new foo"
                                                                                                     :field/previous-value "foo"}
@@ -464,27 +540,29 @@
                             (is (= expected-application (apply-events events)))
 
                             (testing "> submitted"
-                              (let [events (conj events
-                                                 {:event/type :application.event/submitted
-                                                  :event/time (DateTime. 7000)
-                                                  :event/actor "applicant"
-                                                  :application/id 1})
+                              (let [new-event {:event/type :application.event/submitted
+                                               :event/time (DateTime. 7000)
+                                               :event/actor "applicant"
+                                               :application/id 1}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 7000)
-                                                                 :application/events events
+                                                                 :application/events enriched-events
                                                                  :application/state :application.state/submitted
                                                                  :application/todo :resubmitted-application})]
                                 (is (= expected-application (apply-events events)))))))
 
                         (testing "> submitted (no draft saved)"
-                          (let [events (conj events
-                                             {:event/type :application.event/submitted
-                                              :event/time (DateTime. 7000)
-                                              :event/actor "applicant"
-                                              :application/id 1})
+                          (let [new-event {:event/type :application.event/submitted
+                                           :event/time (DateTime. 7000)
+                                           :event/actor "applicant"
+                                           :application/id 1}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                                 expected-application (deep-merge expected-application
                                                                  {:application/last-activity (DateTime. 7000)
-                                                                  :application/events events
+                                                                  :application/events enriched-events
                                                                   :application/state :application.state/submitted
                                                                   :application/todo :resubmitted-application
                                                                   ;; when there was no draft-saved event, the current and
@@ -496,23 +574,30 @@
                             (is (= expected-application (apply-events events)))))))
 
                     (testing "> resources changed by handler"
-                      (let [events (conj events
-                                         {:event/type :application.event/resources-changed
-                                          :event/time (DateTime. 3400)
-                                          :event/actor "handler"
-                                          :application/id 1
-                                          :application/comment "You should include this resource."
-                                          :application/resources [{:catalogue-item/id 10 :resource/ext-id "urn:11"}
-                                                                  {:catalogue-item/id 20 :resource/ext-id "urn:21"}
-                                                                  {:catalogue-item/id 30 :resource/ext-id "urn:31"}]
-                                          :application/licenses [{:license/id 30}
-                                                                 {:license/id 31}
-                                                                 {:license/id 32}
-                                                                 {:license/id 34}]})
+                      (let [new-event {:event/type :application.event/resources-changed
+                                       :event/time (DateTime. 3400)
+                                       :event/actor "handler"
+                                       :application/id 1
+                                       :application/comment "You should include this resource."
+                                       :application/resources [{:catalogue-item/id 10 :resource/ext-id "urn:11"}
+                                                               {:catalogue-item/id 20 :resource/ext-id "urn:21"}
+                                                               {:catalogue-item/id 30 :resource/ext-id "urn:31"}]
+                                       :application/licenses [{:license/id 30}
+                                                              {:license/id 31}
+                                                              {:license/id 32}
+                                                              {:license/id 34}]}
+                            events (conj events new-event)
+                            enriched-events
+                            (conj enriched-events (merge new-event
+                                                         {:event/actor-attributes (get-user "handler")
+                                                          :application/resources
+                                                          [resource-id-11
+                                                           resource-id-21
+                                                           resource-id-31]}))
                             expected-application (deep-merge expected-application
                                                              {:application/last-activity (DateTime. 3400)
                                                               :application/modified (DateTime. 3400)
-                                                              :application/events events
+                                                              :application/events enriched-events
                                                               :application/resources (conj (:application/resources expected-application)
                                                                                            {:catalogue-item/id 30
                                                                                             :resource/id 31
@@ -538,17 +623,18 @@
                                                                                            :license/archived false})})]
                         (is (= expected-application (apply-events events)))))
                     (testing "> licenses added"
-                      (let [events (conj events
-                                         {:event/type :application.event/licenses-added
-                                          :event/time (DateTime. 3500)
-                                          :event/actor "handler"
-                                          :application/id 1
-                                          :application/licenses [{:license/id 33}]
-                                          :application/comment "Please sign these terms also"})
+                      (let [new-event {:event/type :application.event/licenses-added
+                                       :event/time (DateTime. 3500)
+                                       :event/actor "handler"
+                                       :application/id 1
+                                       :application/licenses [{:license/id 33}]
+                                       :application/comment "Please sign these terms also"}
+                            events (conj events new-event)
+                            enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "handler")))
                             expected-application (merge expected-application
                                                         {:application/last-activity (DateTime. 3500)
                                                          :application/modified (DateTime. 3500)
-                                                         :application/events events
+                                                         :application/events enriched-events
                                                          :application/licenses (conj (:application/licenses expected-application)
                                                                                      {:license/id 33
                                                                                       :license/type :attachment
@@ -563,38 +649,45 @@
                         (is (= expected-application (apply-events events)))
 
                         (testing "> approved"
-                          (let [events (conj events
-                                             {:event/type :application.event/approved
-                                              :event/time (DateTime. 4000)
-                                              :event/actor "handler"
-                                              :application/id 1
-                                              :application/comment "looks good"})
+                          (let [new-event {:event/type :application.event/approved
+                                           :event/time (DateTime. 4000)
+                                           :event/actor "handler"
+                                           :application/id 1
+                                           :application/comment "looks good"}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "handler")))
                                 expected-application (merge expected-application
                                                             {:application/last-activity (DateTime. 4000)
-                                                             :application/events events
+                                                             :application/events enriched-events
                                                              :application/state :application.state/approved
                                                              :application/todo nil})]
                             (is (= expected-application (apply-events events)))
 
                             (testing "> resources changed by handler"
-                              (let [events (conj events
-                                                 {:event/type :application.event/resources-changed
-                                                  :event/time (DateTime. 4500)
-                                                  :event/actor "handler"
-                                                  :application/id 1
-                                                  :application/comment "I changed the resources"
-                                                  :application/resources [{:catalogue-item/id 10 :resource/ext-id "urn:11"}
-                                                                          {:catalogue-item/id 30 :resource/ext-id "urn:31"}]
-                                                  :application/licenses [{:license/id 30}
-                                                                         {:license/id 31}
-                                                                         {:license/id 32}
-                                                                         ;; Include also the previously added license #33 in the new licenses.
-                                                                         {:license/id 33}
-                                                                         {:license/id 34}]})
+                              (let [new-event {:event/type :application.event/resources-changed
+                                               :event/time (DateTime. 4500)
+                                               :event/actor "handler"
+                                               :application/id 1
+                                               :application/comment "I changed the resources"
+                                               :application/resources [{:catalogue-item/id 10 :resource/ext-id "urn:11"}
+                                                                       {:catalogue-item/id 30 :resource/ext-id "urn:31"}]
+                                               :application/licenses [{:license/id 30}
+                                                                      {:license/id 31}
+                                                                      {:license/id 32}
+                                                                      ;; Include also the previously added license #33 in the new licenses.
+                                                                      {:license/id 33}
+                                                                      {:license/id 34}]}
+                                    events (conj events new-event)
+                                    enriched-events
+                                    (conj enriched-events (merge new-event
+                                                                 {:event/actor-attributes (get-user "handler")
+                                                                  :application/resources
+                                                                  [resource-id-11
+                                                                   resource-id-31]}))
                                     expected-application (deep-merge expected-application
                                                                      {:application/last-activity (DateTime. 4500)
                                                                       :application/modified (DateTime. 4500)
-                                                                      :application/events events
+                                                                      :application/events enriched-events
                                                                       :application/resources [{:catalogue-item/id 10
                                                                                                :resource/id 11
                                                                                                :resource/ext-id "urn:11"
@@ -631,235 +724,262 @@
                                 (is (= expected-application (apply-events events)))))
 
                             (testing "> licenses accepted"
-                              (let [events (conj events
-                                                 {:event/type :application.event/licenses-accepted
-                                                  :event/time (DateTime. 4500)
-                                                  :event/actor "applicant"
-                                                  :application/id 1
-                                                  :application/accepted-licenses #{30 31 32 33}})
+                              (let [new-event {:event/type :application.event/licenses-accepted
+                                               :event/time (DateTime. 4500)
+                                               :event/actor "applicant"
+                                               :application/id 1
+                                               :application/accepted-licenses #{30 31 32 33}}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 4500)
-                                                                 :application/events events
+                                                                 :application/events enriched-events
                                                                  :application/accepted-licenses {"applicant" #{30 31 32 33}}})]
                                 (is (= expected-application (apply-events events)))
 
                                 (testing "> member added"
-                                  (let [events (conj events
-                                                     {:event/type :application.event/member-added
-                                                      :event/time (DateTime. 4600)
-                                                      :event/actor "handler"
-                                                      :application/id 1
-                                                      :application/member {:userid "member"}})
+                                  (let [new-event {:event/type :application.event/member-added
+                                                   :event/time (DateTime. 4600)
+                                                   :event/actor "handler"
+                                                   :application/id 1
+                                                   :application/member {:userid "member"}}
+                                        events (conj events new-event)
+                                        enriched-events
+                                        (conj enriched-events (merge new-event
+                                                                     {:event/actor-attributes (get-user "handler")
+                                                                      :application/member (get-user "member")}))
                                         expected-application (merge expected-application
                                                                     {:application/last-activity (DateTime. 4600)
-                                                                     :application/events events
-                                                                     :application/members #{{:userid "member"}}})]
+                                                                     :application/events enriched-events
+                                                                     :application/members #{{:userid "member", :eppn "member", :mail "member@example.com", :commonName "Member"}}})]
                                     (is (= expected-application (apply-events events)))
                                     (testing "> licenses accepted for new member"
-                                      (let [events (conj events
-                                                         {:event/type :application.event/licenses-accepted
-                                                          :event/time (DateTime. 4700)
-                                                          :event/actor "member"
-                                                          :application/id 1
-                                                          :application/accepted-licenses #{30 33}})
+                                      (let [new-event {:event/type :application.event/licenses-accepted
+                                                       :event/time (DateTime. 4700)
+                                                       :event/actor "member"
+                                                       :application/id 1
+                                                       :application/accepted-licenses #{30 33}}
+                                            events (conj events new-event)
+                                            enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "member")))
                                             expected-application (merge expected-application
                                                                         {:application/last-activity (DateTime. 4700)
-                                                                         :application/events events
+                                                                         :application/events enriched-events
                                                                          :application/accepted-licenses {"applicant" #{30 31 32 33}
                                                                                                          "member" #{30 33}}})]
                                         (is (= expected-application (apply-events events)))
                                         (testing "> licenses accepted overwrites previous"
-                                          (let [events (conj events
-                                                             {:event/type :application.event/licenses-accepted
-                                                              :event/time (DateTime. 4800)
-                                                              :event/actor "member"
-                                                              :application/id 1
-                                                              :application/accepted-licenses #{31 32}})
+                                          (let [new-event {:event/type :application.event/licenses-accepted
+                                                           :event/time (DateTime. 4800)
+                                                           :event/actor "member"
+                                                           :application/id 1
+                                                           :application/accepted-licenses #{31 32}}
+                                                events (conj events new-event)
+                                                enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "member")))
                                                 expected-application (merge expected-application
                                                                             {:application/last-activity (DateTime. 4800)
-                                                                             :application/events events
+                                                                             :application/events enriched-events
                                                                              :application/accepted-licenses {"applicant" #{30 31 32 33}
                                                                                                              "member" #{31 32}}})]
                                             (is (= expected-application (apply-events events)))))))))
 
 
                                 (testing "> closed"
-                                  (let [events (conj events
-                                                     {:event/type :application.event/closed
-                                                      :event/time (DateTime. 5000)
-                                                      :event/actor "handler"
-                                                      :application/id 1
-                                                      :application/comment "the project is finished"})
+                                  (let [new-event {:event/type :application.event/closed
+                                                   :event/time (DateTime. 5000)
+                                                   :event/actor "handler"
+                                                   :application/id 1
+                                                   :application/comment "the project is finished"}
+                                        events (conj events new-event)
+                                        enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "handler")))
                                         expected-application (merge expected-application
                                                                     {:application/last-activity (DateTime. 5000)
-                                                                     :application/events events
+                                                                     :application/events enriched-events
                                                                      :application/state :application.state/closed
                                                                      :application/todo nil})]
                                     (is (= expected-application (apply-events events)))))
 
                                 (testing "> revoked"
-                                  (let [events (conj events
-                                                     {:event/type :application.event/revoked
-                                                      :event/time (DateTime. 5000)
-                                                      :event/actor "handler"
-                                                      :application/id 1
-                                                      :application/comment "license terms were violated"})
+                                  (let [new-event {:event/type :application.event/revoked
+                                                   :event/time (DateTime. 5000)
+                                                   :event/actor "handler"
+                                                   :application/id 1
+                                                   :application/comment "license terms were violated"}
+                                        events (conj events new-event)
+                                        enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "handler")))
                                         expected-application (merge expected-application
                                                                     {:application/last-activity (DateTime. 5000)
-                                                                     :application/events events
+                                                                     :application/events enriched-events
                                                                      :application/state :application.state/revoked
                                                                      :application/todo nil})]
                                     (is (= expected-application (apply-events events)))))))))
 
                         (testing "> rejected"
-                          (let [events (conj events
-                                             {:event/type :application.event/rejected
-                                              :event/time (DateTime. 4000)
-                                              :event/actor "handler"
-                                              :application/id 1
-                                              :application/comment "never gonna happen"})
+                          (let [new-event {:event/type :application.event/rejected
+                                           :event/time (DateTime. 4000)
+                                           :event/actor "handler"
+                                           :application/id 1
+                                           :application/comment "never gonna happen"}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "handler")))
                                 expected-application (merge expected-application
                                                             {:application/last-activity (DateTime. 4000)
-                                                             :application/events events
+                                                             :application/events enriched-events
                                                              :application/state :application.state/rejected
                                                              :application/todo nil})]
                             (is (= expected-application (apply-events events)))))
 
                         (testing "> comment requested"
                           (let [request-id (UUID/fromString "4de6c2b0-bb2e-4745-8f92-bd1d1f1e8298")
-                                events (conj events
-                                             {:event/type :application.event/comment-requested
-                                              :event/time (DateTime. 4000)
-                                              :event/actor "handler"
-                                              :application/id 1
-                                              :application/request-id request-id
-                                              :application/commenters ["commenter"]
-                                              :application/comment "please comment"})
+                                new-event {:event/type :application.event/comment-requested
+                                           :event/time (DateTime. 4000)
+                                           :event/actor "handler"
+                                           :application/id 1
+                                           :application/request-id request-id
+                                           :application/commenters ["commenter"]
+                                           :application/comment "please comment"}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (merge new-event
+                                                                             {:event/actor-attributes (get-user "handler")
+                                                                              :application/commenters [(get-user "commenter")]}))
                                 expected-application (deep-merge expected-application
                                                                  {:application/last-activity (DateTime. 4000)
-                                                                  :application/events events
+                                                                  :application/events enriched-events
                                                                   :application/todo :waiting-for-review
                                                                   :rems.application.model/latest-comment-request-by-user {"commenter" request-id}})]
                             (is (= expected-application (apply-events events)))
 
                             (testing "> commented"
-                              (let [events (conj events
-                                                 {:event/type :application.event/commented
-                                                  :event/time (DateTime. 5000)
-                                                  :event/actor "commenter"
-                                                  :application/id 1
-                                                  :application/request-id request-id
-                                                  :application/comment "looks good"})
+                              (let [new-event {:event/type :application.event/commented
+                                               :event/time (DateTime. 5000)
+                                               :event/actor "commenter"
+                                               :application/id 1
+                                               :application/request-id request-id
+                                               :application/comment "looks good"}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "commenter")))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 5000)
-                                                                 :application/events events
+                                                                 :application/events enriched-events
                                                                  :application/todo :no-pending-requests
                                                                  :rems.application.model/latest-comment-request-by-user {}})]
                                 (is (= expected-application (apply-events events)))))))
 
                         (testing "> decision requested"
                           (let [request-id (UUID/fromString "db9c7fd6-53be-4b04-b15d-a3a8e0a45e49")
-                                events (conj events
-                                             {:event/type :application.event/decision-requested
-                                              :event/time (DateTime. 4000)
-                                              :event/actor "handler"
-                                              :application/id 1
-                                              :application/request-id request-id
-                                              :application/deciders ["decider"]
-                                              :application/comment "please decide"})
+                                new-event {:event/type :application.event/decision-requested
+                                           :event/time (DateTime. 4000)
+                                           :event/actor "handler"
+                                           :application/id 1
+                                           :application/request-id request-id
+                                           :application/deciders ["decider"]
+                                           :application/comment "please decide"}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (merge new-event
+                                                                             {:event/actor-attributes (get-user "handler")
+                                                                              :application/deciders [(get-user "decider")]}))
                                 expected-application (merge expected-application
                                                             {:application/last-activity (DateTime. 4000)
-                                                             :application/events events
+                                                             :application/events enriched-events
                                                              :application/todo :waiting-for-decision
                                                              :rems.application.model/latest-decision-request-by-user {"decider" request-id}})]
                             (is (= expected-application (apply-events events)))
 
                             (testing "> decided"
-                              (let [events (conj events
-                                                 {:event/type :application.event/decided
-                                                  :event/time (DateTime. 5000)
-                                                  :event/actor "decider"
-                                                  :application/id 1
-                                                  :application/request-id request-id
-                                                  :application/decision :approved
-                                                  :application/comment "I approve this"})
+                              (let [new-event {:event/type :application.event/decided
+                                               :event/time (DateTime. 5000)
+                                               :event/actor "decider"
+                                               :application/id 1
+                                               :application/request-id request-id
+                                               :application/decision :approved
+                                               :application/comment "I approve this"}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "decider")))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 5000)
-                                                                 :application/events events
+                                                                 :application/events enriched-events
                                                                  :application/todo :no-pending-requests
                                                                  :rems.application.model/latest-decision-request-by-user {}})]
                                 (is (= expected-application (apply-events events)))))))
 
                         (testing "> member invited"
                           (let [token "b187bda7b9da9053a5d8b815b029e4ba"
-                                events (conj events
-                                             {:event/type :application.event/member-invited
-                                              :event/time (DateTime. 4000)
-                                              :event/actor "applicant"
-                                              :application/id 1
-                                              :application/member {:name "Mr. Member"
-                                                                   :email "member@example.com"}
-                                              :invitation/token token})
+                                new-event {:event/type :application.event/member-invited
+                                           :event/time (DateTime. 4000)
+                                           :event/actor "applicant"
+                                           :application/id 1
+                                           :application/member {:name "Mr. Member"
+                                                                :email "member@example.com"}
+                                           :invitation/token token}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                                 expected-application (deep-merge expected-application
                                                                  {:application/last-activity (DateTime. 4000)
-                                                                  :application/events events
+                                                                  :application/events enriched-events
                                                                   :application/invitation-tokens {token {:name "Mr. Member"
                                                                                                          :email "member@example.com"}}})]
                             (is (= expected-application (apply-events events)))
 
                             (testing "> member uninvited"
-                              (let [events (conj events
-                                                 {:event/type :application.event/member-uninvited
-                                                  :event/time (DateTime. 5000)
-                                                  :event/actor "applicant"
-                                                  :application/id 1
-                                                  :application/member {:name "Mr. Member"
-                                                                       :email "member@example.com"}
-                                                  :application/comment "he left the project"})
+                              (let [new-event {:event/type :application.event/member-uninvited
+                                               :event/time (DateTime. 5000)
+                                               :event/actor "applicant"
+                                               :application/id 1
+                                               :application/member {:name "Mr. Member"
+                                                                    :email "member@example.com"}
+                                               :application/comment "he left the project"}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "applicant")))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 5000)
-                                                                 :application/events events
+                                                                 :application/events enriched-events
                                                                  :application/invitation-tokens {}})]
                                 (is (= expected-application (apply-events events)))))
 
                             (testing "> member joined"
-                              (let [events (conj events
-                                                 {:event/type :application.event/member-joined
-                                                  :event/time (DateTime. 5000)
-                                                  :event/actor "member"
-                                                  :application/id 1
-                                                  :invitation/token token})
+                              (let [new-event {:event/type :application.event/member-joined
+                                               :event/time (DateTime. 5000)
+                                               :event/actor "member"
+                                               :application/id 1
+                                               :invitation/token token}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (assoc new-event :event/actor-attributes (get-user "member")))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 5000)
-                                                                 :application/events events
-                                                                 :application/members #{{:userid "member"}}
+                                                                 :application/events enriched-events
+                                                                 :application/members #{{:userid "member", :eppn "member", :mail "member@example.com", :commonName "Member"}}
                                                                  :application/invitation-tokens {}})]
                                 (is (= expected-application (apply-events events)))))))
 
                         (testing "> member added"
-                          (let [events (conj events
-                                             {:event/type :application.event/member-added
-                                              :event/time (DateTime. 4000)
-                                              :event/actor "handler"
-                                              :application/id 1
-                                              :application/member {:userid "member"}})
+                          (let [new-event {:event/type :application.event/member-added
+                                           :event/time (DateTime. 4000)
+                                           :event/actor "handler"
+                                           :application/id 1
+                                           :application/member {:userid "member"}}
+                                events (conj events new-event)
+                                enriched-events (conj enriched-events (merge new-event
+                                                                             {:event/actor-attributes (get-user "handler")
+                                                                              :application/member (get-user "member")}))
                                 expected-application (merge expected-application
                                                             {:application/last-activity (DateTime. 4000)
-                                                             :application/events events
-                                                             :application/members #{{:userid "member"}}})]
+                                                             :application/events enriched-events
+                                                             :application/members #{{:userid "member", :eppn "member", :mail "member@example.com", :commonName "Member"}}})]
                             (is (= expected-application (apply-events events)))
 
                             (testing "> member removed"
-                              (let [events (conj events
-                                                 {:event/type :application.event/member-removed
-                                                  :event/time (DateTime. 5000)
-                                                  :event/actor "applicant"
-                                                  :application/id 1
-                                                  :application/member {:userid "member"}
-                                                  :application/comment "he left the project"})
+                              (let [new-event {:event/type :application.event/member-removed
+                                               :event/time (DateTime. 5000)
+                                               :event/actor "applicant"
+                                               :application/id 1
+                                               :application/member {:userid "member"}
+                                               :application/comment "he left the project"}
+                                    events (conj events new-event)
+                                    enriched-events (conj enriched-events (merge new-event
+                                                                                 {:event/actor-attributes (get-user "applicant")
+                                                                                  :application/member (get-user "member")}))
                                     expected-application (merge expected-application
                                                                 {:application/last-activity (DateTime. 5000)
-                                                                 :application/events events
+                                                                 :application/events enriched-events
                                                                  :application/members #{}
                                                                  :application/past-members #{{:userid "member"}}})]
                                 (is (= expected-application (apply-events events)))))))))))))))))))
diff --git a/test/clj/rems/test_text.clj b/test/clj/rems/test_text.clj
index 67b4232ab..4797538ed 100644
--- a/test/clj/rems/test_text.clj
+++ b/test/clj/rems/test_text.clj
@@ -45,7 +45,10 @@
                 (sort))))
     (with-language :en
       (fn []
-        (is (not (valid-localization? (localize-event "foobar"))))
+        (is (not (valid-localization? (localize-event {:event/type "foobar"}))))
         (doseq [event-type event-types]
           (testing event-type
-            (is (valid-localization? (localize-event event-type)))))))))
+            (is (valid-localization? (localize-event
+                                      (merge {:event/type event-type}
+                                             (when (= event-type :application.event/decided)
+                                               {:application/decision :approved})))))))))))