瀏覽代碼

enhance(rtc): grant access api support emails

rcmerci 2 年之前
父節點
當前提交
69ef219a71
共有 2 個文件被更改,包括 11 次插入6 次删除
  1. 3 2
      src/main/frontend/db/rtc/core.cljs
  2. 8 4
      src/main/frontend/db/rtc/debug_ui.cljs

+ 3 - 2
src/main/frontend/db/rtc/core.cljs

@@ -636,13 +636,14 @@
 
 
 (defn <grant-graph-access-to-others
-  [state graph-uuid target-user-uuids]
+  [state graph-uuid & {:keys [target-user-uuids target-user-emails]}]
   (go
     (let [r (with-sub-data-from-ws state
               (<! (ws/<send! state {:req-id (get-req-id)
                                     :action "grant-access"
                                     :graph-uuid graph-uuid
-                                    :target-user-uuids target-user-uuids}))
+                                    :target-user-uuids target-user-uuids
+                                    :target-user-emails target-user-emails}))
 
               (<! (get-result-ch)))]
       (when-let [ex-message (:ex-message r)]

+ 8 - 4
src/main/frontend/db/rtc/debug_ui.cljs

@@ -141,16 +141,20 @@
                    {:class "mr-2"
                     :on-click (fn []
                                 (go
-                                  (when-let [user-uuid (some-> @(::grant-access-to-user state) parse-uuid)]
+                                  (let [user-uuid (some-> @(::grant-access-to-user state) parse-uuid)
+                                        user-email (when-not user-uuid @(::grant-access-to-user state))]
                                     (when-let [graph-uuid @(::graph-uuid state)]
-                                      (<! (rtc-core/<grant-graph-access-to-others s graph-uuid [user-uuid]))))))})
+                                      (<! (rtc-core/<grant-graph-access-to-others
+                                           s graph-uuid
+                                           :target-user-uuids [user-uuid]
+                                           :target-user-emails [user-email]))))))})
 
         [:input.form-input.my-2
          {:on-change (fn [e] (reset! (::grant-access-to-user state) (util/evalue e)))
           :on-focus (fn [e] (let [v (.-value (.-target e))]
-                              (when (= v "input user-uuid here")
+                              (when (= v "input email or user-uuid here")
                                 (set! (.-value (.-target e)) ""))))
-          :default-value "input user-uuid here"}]])
+          :default-value "input email or user-uuid here"}]])
      [:hr]
      [:div.flex.flex-row
       (ui/button (str "download graph to")