mirror of
https://github.com/logseq/logseq.git
synced 2026-05-24 04:34:14 +00:00
refactor: DRY
This commit is contained in:
@@ -546,15 +546,13 @@
|
||||
(when (or (seq retract-refs) pre-block?)
|
||||
(ui-handler/re-render-root!))
|
||||
|
||||
(when (state/git-auto-push?)
|
||||
(repo-handler/push repo nil)))
|
||||
(repo-handler/push-if-auto-enabled! repo))
|
||||
|
||||
:else
|
||||
nil))
|
||||
|
||||
(seq (state/get-changed-files))
|
||||
(when (state/git-auto-push?)
|
||||
(repo-handler/push repo nil))
|
||||
(repo-handler/push-if-auto-enabled! repo)
|
||||
|
||||
:else
|
||||
nil))))
|
||||
@@ -1016,8 +1014,7 @@
|
||||
(route-handler/redirect! {:to :page
|
||||
:path-params {:name (:page/name page)}})
|
||||
(ui-handler/re-render-root!))
|
||||
(when (state/git-auto-push?)
|
||||
(repo-handler/push repo nil))))))
|
||||
(repo-handler/push-if-auto-enabled! repo)))))
|
||||
|
||||
(defn remove-block-property!
|
||||
[block-id key]
|
||||
|
||||
@@ -257,8 +257,7 @@
|
||||
file-path)
|
||||
nil)]
|
||||
(common-handler/check-changed-files-status)
|
||||
(when (state/git-auto-push?)
|
||||
(repo-handler/push repo nil)))
|
||||
(repo-handler/push-if-auto-enabled! repo))
|
||||
(p/catch (fn [err]
|
||||
(prn "error: " err))))))
|
||||
|
||||
@@ -304,8 +303,7 @@
|
||||
|
||||
(notification/show! "Page renamed successfully!" :success)
|
||||
|
||||
(when (state/git-auto-push?)
|
||||
(repo-handler/push repo nil))
|
||||
(repo-handler/push-if-auto-enabled! repo)
|
||||
|
||||
(ui-handler/re-render-root!)))))
|
||||
|
||||
|
||||
@@ -437,6 +437,11 @@
|
||||
(println "Git push error: ")
|
||||
(js/console.dir error)))))))
|
||||
|
||||
(defn push-if-auto-enabled!
|
||||
[repo]
|
||||
(when (state/git-auto-push?)
|
||||
(push repo nil)))
|
||||
|
||||
(defn pull-current-repo
|
||||
[]
|
||||
(when-let [repo (state/get-current-repo)]
|
||||
|
||||
Reference in New Issue
Block a user