enhance(rtc): grant access api support emails

This commit is contained in:
rcmerci
2023-10-25 13:50:22 +08:00
parent 211dd6aea7
commit 69ef219a71
2 changed files with 11 additions and 6 deletions

View File

@@ -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)]

View File

@@ -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")