diff --git a/src/main/frontend/components/repo.cljs b/src/main/frontend/components/repo.cljs index 6c597f3943..4ebb704933 100644 --- a/src/main/frontend/components/repo.cljs +++ b/src/main/frontend/components/repo.cljs @@ -65,58 +65,61 @@ [:div.controls [:div.flex.flex-row.items-center - (ui/tippy {:html [:div.text-sm.max-w-xs - (cond - only-cloud? - "Deletes this remote graph. Note this can't be recovered." + (let [current-repo (state/get-current-repo) + db-graph? (config/db-based-graph? current-repo) + manager? (and db-graph? (user-handler/manager? current-repo))] + (when-not (and db-graph? only-cloud? (not manager?)) + (ui/tippy {:html [:div.text-sm.max-w-xs + (cond + only-cloud? + "Deletes this remote graph. Note this can't be recovered." - db-based? - "Unsafe delete this DB-based graph. Note this can't be recovered." + db-based? + "Unsafe delete this DB-based graph. Note this can't be recovered." - :else - "Removes Logseq's access to the local file path of your graph. It won't remove your local files.")] - :class "tippy-hover" - :interactive true} - [:a.text-gray-400.ml-4.font-medium.text-sm.whitespace-nowrap - {:on-click (fn [] - (let [has-prompt? (or only-cloud? db-based?) - prompt-str (cond only-cloud? - (str "Are you sure to permanently delete the graph \"" GraphName "\" from our server?") - db-based? - (str "Are you sure to permanently delete the graph \"" url "\" from Logseq?") - :else - "") - unlink-or-remote-fn (fn [] - (let [current-repo (state/get-current-repo)] - (repo-handler/remove-repo! repo) - (state/pub-event! [:graph/unlinked repo current-repo]))) - action-confirm-fn (if only-cloud? - (fn [] - (let [current-repo (state/get-current-repo) - delete-graph (if (config/db-based-graph? current-repo) - rtc-handler/ (some #(when (= uuid (:GraphUUID %)) %) (:rtc/graphs @state/state)) + :graph<->user-user-type))) + +(defn manager? + [repo] + (= (get-user-type repo) "manager")) + +(defn member? + [repo] + (= (get-user-type repo) "member")) + (comment ;; We probably need this for some new features later (defonce feature-matrix {:file-sync :beta})