|
@@ -917,7 +917,7 @@
|
|
|
(<! (ws/<ensure-ws-open! state))
|
|
(<! (ws/<ensure-ws-open! state))
|
|
|
(reset! (:*graph-uuid state) graph-uuid)
|
|
(reset! (:*graph-uuid state) graph-uuid)
|
|
|
(with-sub-data-from-ws state
|
|
(with-sub-data-from-ws state
|
|
|
- (<! (ws/<send! state {:action "register-graph-updates" :req-id (get-req-id) :graph-uuid graph-uuid}))
|
|
|
|
|
|
|
+ (<? (ws/<send! state {:action "register-graph-updates" :req-id (get-req-id) :graph-uuid graph-uuid}))
|
|
|
(<! (get-result-ch)))
|
|
(<! (get-result-ch)))
|
|
|
|
|
|
|
|
(async/sub data-from-ws-pub "push-updates" push-data-from-ws-ch)
|
|
(async/sub data-from-ws-pub "push-updates" push-data-from-ws-ch)
|
|
@@ -962,7 +962,7 @@
|
|
|
[state graph-uuid & {:keys [target-user-uuids target-user-emails]}]
|
|
[state graph-uuid & {:keys [target-user-uuids target-user-emails]}]
|
|
|
(go
|
|
(go
|
|
|
(let [r (with-sub-data-from-ws state
|
|
(let [r (with-sub-data-from-ws state
|
|
|
- (<! (ws/<send! state (cond-> {:req-id (get-req-id)
|
|
|
|
|
|
|
+ (<? (ws/<send! state (cond-> {:req-id (get-req-id)
|
|
|
:action "grant-access"
|
|
:action "grant-access"
|
|
|
:graph-uuid graph-uuid}
|
|
:graph-uuid graph-uuid}
|
|
|
target-user-uuids (assoc :target-user-uuids target-user-uuids)
|
|
target-user-uuids (assoc :target-user-uuids target-user-uuids)
|
|
@@ -985,7 +985,7 @@
|
|
|
(go
|
|
(go
|
|
|
(when (some-> state :*graph-uuid deref)
|
|
(when (some-> state :*graph-uuid deref)
|
|
|
(with-sub-data-from-ws state
|
|
(with-sub-data-from-ws state
|
|
|
- (<! (ws/<send! state {:req-id (get-req-id)
|
|
|
|
|
|
|
+ (<? (ws/<send! state {:req-id (get-req-id)
|
|
|
:action "query-block-content-versions"
|
|
:action "query-block-content-versions"
|
|
|
:block-uuids [block-uuid]
|
|
:block-uuids [block-uuid]
|
|
|
:graph-uuid @(:*graph-uuid state)}))
|
|
:graph-uuid @(:*graph-uuid state)}))
|
|
@@ -1104,17 +1104,35 @@
|
|
|
(go
|
|
(go
|
|
|
(let [state (or @*state (<! (<init-state repo token true)))
|
|
(let [state (or @*state (<! (<init-state repo token true)))
|
|
|
graph-list (with-sub-data-from-ws state
|
|
graph-list (with-sub-data-from-ws state
|
|
|
- (<! (ws/<send! state {:req-id (get-req-id)
|
|
|
|
|
|
|
+ (<? (ws/<send! state {:req-id (get-req-id)
|
|
|
:action "list-graphs"}))
|
|
:action "list-graphs"}))
|
|
|
(:graphs (<! (get-result-ch))))]
|
|
(:graphs (<! (get-result-ch))))]
|
|
|
(p/resolve! d (bean/->js graph-list))))
|
|
(p/resolve! d (bean/->js graph-list))))
|
|
|
d))
|
|
d))
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+(defn <delete-graph
|
|
|
|
|
+ [token graph-uuid]
|
|
|
|
|
+ (let [d (p/deferred)]
|
|
|
|
|
+ (go
|
|
|
|
|
+ (let [state (or @*state (<! (<init-state nil token true)))
|
|
|
|
|
+ r (with-sub-data-from-ws state
|
|
|
|
|
+ (<? (ws/<send! state {:req-id (get-req-id)
|
|
|
|
|
+ :action "delete-graph"
|
|
|
|
|
+ :graph-uuid graph-uuid}))
|
|
|
|
|
+ (<! (get-result-ch)))
|
|
|
|
|
+ {:keys [ex-message]} r]
|
|
|
|
|
+ (if ex-message
|
|
|
|
|
+ (do (prn ::delete-graph-failed graph-uuid)
|
|
|
|
|
+ (p/resolve! d false))
|
|
|
|
|
+ (p/resolve! d true))))
|
|
|
|
|
+ d))
|
|
|
|
|
+
|
|
|
(add-watch *state :notify-main-thread
|
|
(add-watch *state :notify-main-thread
|
|
|
(fn [_ _ old new]
|
|
(fn [_ _ old new]
|
|
|
- (when-let [*repo (:*repo new)]
|
|
|
|
|
- (let [new-state (get-debug-state @*repo new)
|
|
|
|
|
- old-state (get-debug-state @*repo old)]
|
|
|
|
|
|
|
+ (when-let [repo @(:*repo new)]
|
|
|
|
|
+ (let [new-state (get-debug-state repo new)
|
|
|
|
|
+ old-state (get-debug-state repo old)]
|
|
|
(when (or (not= new-state old-state)
|
|
(when (or (not= new-state old-state)
|
|
|
(= :open (:rtc-state new-state)))
|
|
(= :open (:rtc-state new-state)))
|
|
|
(worker-util/post-message :rtc-sync-state new-state))))))
|
|
(worker-util/post-message :rtc-sync-state new-state))))))
|