mirror of
https://github.com/penpot/penpot.git
synced 2025-05-27 22:36:11 +02:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
commit
e188ae732a
3 changed files with 87 additions and 77 deletions
|
@ -33,26 +33,20 @@
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
||||||
## 1.12.2-beta
|
## 1.12.2-beta
|
||||||
### :boom: Breaking changes
|
|
||||||
|
|
||||||
### :sparkles: New features
|
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
- Fix issue with guides over shape handlers [Taiga #3032](https://tree.taiga.io/project/penpot/issue/3032)
|
- Fix issue with guides over shape handlers [Taiga #3032](https://tree.taiga.io/project/penpot/issue/3032)
|
||||||
- Fix problem with shift+ctrl+click to select [#1671](https://github.com/penpot/penpot/issues/1671)
|
- Fix problem with shift+ctrl+click to select [#1671](https://github.com/penpot/penpot/issues/1671)
|
||||||
|
- Fix ellipsis in long page names [Taiga #2962](https://tree.taiga.io/project/penpot/issue/2962)
|
||||||
|
|
||||||
## 1.12.1-beta
|
## 1.12.1-beta
|
||||||
### :boom: Breaking changes
|
|
||||||
|
|
||||||
### :sparkles: New features
|
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
- Fix length of names in sidebar [Taiga #2962](https://tree.taiga.io/project/penpot/issue/2962)
|
- Fix length of names in sidebar [Taiga #2962](https://tree.taiga.io/project/penpot/issue/2962)
|
||||||
- Fix issues on loki integration
|
- Fix issues on loki integration
|
||||||
|
|
||||||
### :heart: Community contributions by (Thank you!)
|
|
||||||
|
|
||||||
## 1.12.0-beta
|
## 1.12.0-beta
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (ptk/event ::ev/initialize)
|
(rx/of (ev/initialize)
|
||||||
(du/initialize-profile))
|
(du/initialize-profile))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter du/profile-fetched?)
|
||||||
|
@ -79,6 +79,7 @@
|
||||||
[]
|
[]
|
||||||
(mf/unmount (dom/get-element "app"))
|
(mf/unmount (dom/get-element "app"))
|
||||||
(mf/unmount (dom/get-element "modal"))
|
(mf/unmount (dom/get-element "modal"))
|
||||||
|
(st/emit! (ev/initialize))
|
||||||
(init-ui))
|
(init-ui))
|
||||||
|
|
||||||
(defn ^:dev/after-load after-load
|
(defn ^:dev/after-load after-load
|
||||||
|
@ -91,4 +92,3 @@
|
||||||
(fn [_ _ old-value current-value]
|
(fn [_ _ old-value current-value]
|
||||||
(when (not= old-value current-value)
|
(when (not= old-value current-value)
|
||||||
(reinit))))
|
(reinit))))
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
["ua-parser-js" :as UAParser]
|
["ua-parser-js" :as UAParser]
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.logging :as l]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.util.globals :as g]
|
[app.util.globals :as g]
|
||||||
|
@ -20,6 +21,8 @@
|
||||||
[lambdaisland.uri :as u]
|
[lambdaisland.uri :as u]
|
||||||
[potok.core :as ptk]))
|
[potok.core :as ptk]))
|
||||||
|
|
||||||
|
(l/set-level! :info)
|
||||||
|
|
||||||
;; Defines the maximum buffer size, after events start discarding.
|
;; Defines the maximum buffer size, after events start discarding.
|
||||||
(def max-buffer-size 1024)
|
(def max-buffer-size 1024)
|
||||||
|
|
||||||
|
@ -94,11 +97,13 @@
|
||||||
(derive :app.main.data.fonts/add-font ::generic-action)
|
(derive :app.main.data.fonts/add-font ::generic-action)
|
||||||
(derive :app.main.data.fonts/delete-font ::generic-action)
|
(derive :app.main.data.fonts/delete-font ::generic-action)
|
||||||
(derive :app.main.data.fonts/delete-font-variant ::generic-action)
|
(derive :app.main.data.fonts/delete-font-variant ::generic-action)
|
||||||
|
(derive :app.main.data.modal/show-modal ::generic-action)
|
||||||
(derive :app.main.data.users/logout ::generic-action)
|
(derive :app.main.data.users/logout ::generic-action)
|
||||||
(derive :app.main.data.users/request-email-change ::generic-action)
|
(derive :app.main.data.users/request-email-change ::generic-action)
|
||||||
(derive :app.main.data.users/update-password ::generic-action)
|
(derive :app.main.data.users/update-password ::generic-action)
|
||||||
(derive :app.main.data.users/update-photo ::generic-action)
|
(derive :app.main.data.users/update-photo ::generic-action)
|
||||||
(derive :app.main.data.workspace.comments/open-comment-thread ::generic-action)
|
(derive :app.main.data.workspace.comments/open-comment-thread ::generic-action)
|
||||||
|
(derive :app.main.data.workspace.guides/update-guides ::generic-action)
|
||||||
(derive :app.main.data.workspace.libraries/add-color ::generic-action)
|
(derive :app.main.data.workspace.libraries/add-color ::generic-action)
|
||||||
(derive :app.main.data.workspace.libraries/add-media ::generic-action)
|
(derive :app.main.data.workspace.libraries/add-media ::generic-action)
|
||||||
(derive :app.main.data.workspace.libraries/add-typography ::generic-action)
|
(derive :app.main.data.workspace.libraries/add-typography ::generic-action)
|
||||||
|
@ -111,8 +116,6 @@
|
||||||
(derive :app.main.data.workspace/create-page ::generic-action)
|
(derive :app.main.data.workspace/create-page ::generic-action)
|
||||||
(derive :app.main.data.workspace/set-workspace-layout ::generic-action)
|
(derive :app.main.data.workspace/set-workspace-layout ::generic-action)
|
||||||
(derive :app.main.data.workspace/toggle-layout-flag ::generic-action)
|
(derive :app.main.data.workspace/toggle-layout-flag ::generic-action)
|
||||||
(derive :app.main.data.modal/show-modal ::generic-action)
|
|
||||||
(derive :app.main.data.workspace.guides/update-guides ::generic-action)
|
|
||||||
|
|
||||||
(defmulti process-event ptk/type)
|
(defmulti process-event ptk/type)
|
||||||
(defmethod process-event :default [_] nil)
|
(defmethod process-event :default [_] nil)
|
||||||
|
@ -133,17 +136,20 @@
|
||||||
(dissoc ::context)
|
(dissoc ::context)
|
||||||
(cond-> origin (assoc :origin origin)))}))))
|
(cond-> origin (assoc :origin origin)))}))))
|
||||||
|
|
||||||
(defn- filter-props
|
(defn- normalize-props
|
||||||
"Removes complex data types from props."
|
"Removes complex data types from props."
|
||||||
[data]
|
[data]
|
||||||
(into {}
|
(into {}
|
||||||
(map (fn [[k v :as kv]]
|
(comp
|
||||||
(cond
|
(remove (fn [[_ v]] (nil? v)))
|
||||||
(map? v) [k :placeholder/map]
|
(map (fn [[k v :as kv]]
|
||||||
(vector? v) [k :placeholder/vec]
|
(cond
|
||||||
(set? v) [k :placeholder/set]
|
(map? v) [k :placeholder/map]
|
||||||
(coll? v) [k :placeholder/coll]
|
(vector? v) [k :placeholder/vec]
|
||||||
:else kv)))
|
(set? v) [k :placeholder/set]
|
||||||
|
(coll? v) [k :placeholder/coll]
|
||||||
|
(fn? v) [k :placeholder/fn]
|
||||||
|
:else kv))))
|
||||||
data))
|
data))
|
||||||
|
|
||||||
(defmethod process-event ::generic-action
|
(defmethod process-event ::generic-action
|
||||||
|
@ -156,9 +162,8 @@
|
||||||
|
|
||||||
{:type "action"
|
{:type "action"
|
||||||
:name (or (::name mdata) (name type))
|
:name (or (::name mdata) (name type))
|
||||||
:props (-> (merge (d/without-nils data)
|
:props (-> (merge data (::props mdata))
|
||||||
(d/without-nils (::props mdata)))
|
(normalize-props))
|
||||||
(filter-props))
|
|
||||||
:context (d/without-nils
|
:context (d/without-nils
|
||||||
{:event-origin (::origin mdata)
|
{:event-origin (::origin mdata)
|
||||||
:event-namespace (namespace type)
|
:event-namespace (namespace type)
|
||||||
|
@ -174,8 +179,7 @@
|
||||||
:project-id (get-in match [:path-params :project-id])}]
|
:project-id (get-in match [:path-params :project-id])}]
|
||||||
{:name "navigate"
|
{:name "navigate"
|
||||||
:type "action"
|
:type "action"
|
||||||
:timestamp (dt/now)
|
:props (normalize-props props)}))
|
||||||
:props (d/without-nils props)}))
|
|
||||||
|
|
||||||
(defmethod process-event :app.main.data.users/logged-in
|
(defmethod process-event :app.main.data.users/logged-in
|
||||||
[event]
|
[event]
|
||||||
|
@ -191,7 +195,7 @@
|
||||||
{:name "signin"
|
{:name "signin"
|
||||||
:type "identify"
|
:type "identify"
|
||||||
:profile-id (:id data)
|
:profile-id (:id data)
|
||||||
:props (d/without-nils props)}))
|
:props (normalize-props props)}))
|
||||||
|
|
||||||
;; --- MAIN LOOP
|
;; --- MAIN LOOP
|
||||||
|
|
||||||
|
@ -218,60 +222,72 @@
|
||||||
|
|
||||||
(defn initialize
|
(defn initialize
|
||||||
[]
|
[]
|
||||||
(ptk/reify ::initialize
|
(when (contains? @cf/flags :audit-log)
|
||||||
ptk/EffectEvent
|
(ptk/reify ::initialize
|
||||||
(effect [_ _ stream]
|
ptk/EffectEvent
|
||||||
(let [session (atom nil)
|
(effect [_ _ stream]
|
||||||
buffer (atom #queue [])
|
(let [session (atom nil)
|
||||||
profile (->> (rx/from-atom storage {:emit-current-value? true})
|
stoper (rx/filter (ptk/type? ::initialize) stream)
|
||||||
(rx/map :profile)
|
buffer (atom #queue [])
|
||||||
(rx/map :id)
|
profile (->> (rx/from-atom storage {:emit-current-value? true})
|
||||||
(rx/dedupe))]
|
(rx/map :profile)
|
||||||
|
(rx/map :id)
|
||||||
|
(rx/dedupe))]
|
||||||
|
|
||||||
(->> (rx/merge
|
(l/debug :hint "event instrumentation initialized")
|
||||||
(->> (rx/from-atom buffer)
|
|
||||||
(rx/filter #(pos? (count %)))
|
|
||||||
(rx/debounce 2000))
|
|
||||||
(->> stream
|
|
||||||
(rx/filter (ptk/type? :app.main.data.users/logout))
|
|
||||||
(rx/observe-on :async)))
|
|
||||||
(rx/map (fn [_]
|
|
||||||
(into [] (take max-buffer-size) @buffer)))
|
|
||||||
(rx/with-latest-from profile)
|
|
||||||
(rx/mapcat (fn [[chunk profile-id]]
|
|
||||||
(let [events (filterv #(= profile-id (:profile-id %)) chunk)]
|
|
||||||
(->> (persist-events events)
|
|
||||||
(rx/map (constantly chunk))))))
|
|
||||||
(rx/subs (fn [chunk]
|
|
||||||
(swap! buffer remove-from-buffer (count chunk)))))
|
|
||||||
|
|
||||||
|
(->> (rx/merge
|
||||||
|
(->> (rx/from-atom buffer)
|
||||||
|
(rx/filter #(pos? (count %)))
|
||||||
|
(rx/debounce 2000))
|
||||||
|
(->> stream
|
||||||
|
(rx/filter (ptk/type? :app.main.data.users/logout))
|
||||||
|
(rx/observe-on :async)))
|
||||||
|
(rx/map (fn [_]
|
||||||
|
(into [] (take max-buffer-size) @buffer)))
|
||||||
|
(rx/with-latest-from profile)
|
||||||
|
(rx/mapcat (fn [[chunk profile-id]]
|
||||||
|
(let [events (filterv #(= profile-id (:profile-id %)) chunk)]
|
||||||
|
(->> (persist-events events)
|
||||||
|
(rx/tap (fn [_]
|
||||||
|
(l/debug :hint "events chunk persisted" :total (count chunk))))
|
||||||
|
(rx/map (constantly chunk))))))
|
||||||
|
(rx/take-until stoper)
|
||||||
|
(rx/subs (fn [chunk]
|
||||||
|
(swap! buffer remove-from-buffer (count chunk)))
|
||||||
|
(fn [cause]
|
||||||
|
(l/error :hint "unexpected error on audit persistence" :cause cause))
|
||||||
|
(fn []
|
||||||
|
(l/debug :hint "audit persistence terminated"))))
|
||||||
|
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/with-latest-from profile)
|
(rx/with-latest-from profile)
|
||||||
(rx/map (fn [result]
|
(rx/map (fn [result]
|
||||||
(let [event (aget result 0)
|
(let [event (aget result 0)
|
||||||
profile-id (aget result 1)]
|
profile-id (aget result 1)]
|
||||||
(some-> (process-event event)
|
(some-> (process-event event)
|
||||||
(update :profile-id #(or % profile-id))))))
|
(update :profile-id #(or % profile-id))))))
|
||||||
(rx/filter :profile-id)
|
(rx/filter :profile-id)
|
||||||
(rx/map (fn [event]
|
(rx/map (fn [event]
|
||||||
(let [session* (or @session (dt/now))
|
(let [session* (or @session (dt/now))
|
||||||
context (-> @context
|
context (-> @context
|
||||||
(d/merge (:context event))
|
(d/merge (:context event))
|
||||||
(assoc :session session*))]
|
(assoc :session session*))]
|
||||||
(reset! session session*)
|
(reset! session session*)
|
||||||
(-> event
|
(-> event
|
||||||
(assoc :timestamp (dt/now))
|
(assoc :timestamp (dt/now))
|
||||||
(assoc :context context)))))
|
(assoc :context context)))))
|
||||||
|
|
||||||
(rx/tap (fn [event]
|
(rx/tap (fn [event]
|
||||||
(swap! buffer append-to-buffer event)))
|
(l/debug :hint "event enqueued")
|
||||||
|
(swap! buffer append-to-buffer event)))
|
||||||
|
|
||||||
(rx/switch-map #(rx/timer (inst-ms session-timeout)))
|
(rx/switch-map #(rx/timer (inst-ms session-timeout)))
|
||||||
(rx/subs #(reset! session nil)))))))
|
(rx/take-until stoper)
|
||||||
|
(rx/subs (fn [_]
|
||||||
(defmethod ptk/resolve ::initialize
|
(l/debug :hint "session reinitialized")
|
||||||
[_ params]
|
(reset! session nil))
|
||||||
(if (contains? @cf/flags :audit-log)
|
(fn [cause]
|
||||||
(initialize)
|
(l/error :hint "error on event batching stream" :cause cause))
|
||||||
(ptk/data-event ::initialize params)))
|
(fn []
|
||||||
|
(l/debug :hitn "events batching stream terminated")))))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue