Skip to content

Commit

Permalink
Fix post editor for the web UI (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
skydread1 authored Apr 5, 2023
1 parent 9211bf7 commit 62fc49e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions client/common/src/flybot/client/common/db/event.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@
(rf/reg-event-fx
:fx.http/post-success
(fn [{:keys [db]} [_ {:keys [posts]}]]
(let [post (:post posts)
last-editor (or (:post/last-editor post) (:app/user db))]
(let [post (:post posts)]
{:db (assoc db :form/fields (assoc post
:post/last-editor last-editor
:post/last-editor (:app/user db)
:post/last-edit-date (utils/mk-date)))
:fx [[:fx.log/message ["Got the post " (:post/id post)]]]})))

Expand Down
3 changes: 1 addition & 2 deletions common/src/flybot/common/validation.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@
[post user-id]
(let [temp-id? (-> post :post/id u/temporary-id?)
date-field (if temp-id? :post/creation-date :post/last-edit-date)
action (if (:post/author post) :edition :creation)
writer-field (if (= :creation action) :post/author :post/last-editor)]
writer-field (if temp-id? :post/author :post/last-editor)]
(-> post
(dissoc :post/view :post/mode :post/to-delete?)
(update :post/id (if temp-id? (constantly (u/mk-uuid)) identity))
Expand Down
3 changes: 2 additions & 1 deletion dev.cljs.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
^{:watch-dirs ["client/web/src" "client/web/test"]
^{:watch-dirs ["client/web/src" "client/web/test"
"common/src" "client/common/src"]
:css-dirs ["resources/public/css"]}
{:main flybot.client.web.core
:optimizations :none}

0 comments on commit 62fc49e

Please sign in to comment.