Skip to content

Commit

Permalink
resolve true if link is already present
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushgaud committed Nov 15, 2023
1 parent 6e0e6f0 commit d1e0f98
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/wrike_ist/wrike.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,15 @@
(defn check-valid-task
[{:keys [permalink target-branch]}]
(js/Promise.
(fn [resolve reject]
(.info js/console "check-valid-task: Start of the function")
(fn [resolve reject]
(when (and target-branch (str/starts-with? target-branch "main"))
(let [task-in-folder-promise (is-wrike-task-in-folder? permalink)]
(.then task-in-folder-promise
(fn [task-in-folder?]
(if task-in-folder?
(do
(.info js/console "check-valid-task: Task is in the folder or an inherited folder: true")
(resolve))
(resolve true))
(do
(.error js/console "check-valid-task: Task not found in folder")
(reject (js/Error. "check-valid-task: Task not found in folder")))))))))))
Expand Down Expand Up @@ -137,7 +136,7 @@
(.then #(.log js/console (str "link-pr: PR link sent to task")))
(.catch #(if (= % :present)
(.log js/console (str "link-pr: PR link already in comments"))
(js/Promise.reject %))))))))
(js/Promise.resolve %))))))))

(defn folder-statuses
[folder-id]
Expand Down

0 comments on commit d1e0f98

Please sign in to comment.