Browse Source

chore: add team group check

Tienson Qin 11 months ago
parent
commit
60b723a975

+ 2 - 2
src/main/frontend/components/header.cljs

@@ -153,7 +153,6 @@
                   ;; Disable login on Web until RTC is ready
                   (when (and (not login?)
                              (or
-                              config/dev?
                               (storage/get :login-enabled)
                               (not util/web-platform?)))
                     {:title (t :login)
@@ -287,7 +286,8 @@
      [:div.r.flex.drag-region
       (when (and current-repo
                  (user-handler/logged-in?)
-                 (config/db-based-graph? current-repo))
+                 (config/db-based-graph? current-repo)
+                 (user-handler/team-member?))
         [:<>
          (rum/with-key (rtc-collaborators)
            (str "collab-" current-repo))

+ 1 - 1
src/main/frontend/components/repo.cljs

@@ -456,7 +456,7 @@
        :ref input-ref
        :placeholder "your graph name"
        :on-key-down submit!})
-     (when (user-handler/logged-in?)
+     (when (user-handler/team-member?)
        [:div.flex.flex-row.items-center.gap-1
         (shui/checkbox
          {:id "rtc-sync"

+ 2 - 1
src/main/frontend/components/settings.cljs

@@ -1118,7 +1118,8 @@
        (http-server-switcher-row))
      (flashcards-switcher-row enable-flashcards?)
      (when-not db-based? (zotero-settings-row))
-     (when (and config/dev? (config/db-based-graph? current-repo))
+     (when (and (config/db-based-graph? current-repo)
+                (user-handler/team-member?))
        ;; FIXME: Wire this up again to RTC init calls
        (rtc-switcher-row (state/enable-rtc? current-repo)))
      (when-not web-platform?

+ 4 - 0
src/main/frontend/handler/user.cljs

@@ -264,6 +264,10 @@
 
 ;;; user groups
 
+(defn team-member?
+  []
+  (contains? (state/user-groups) "team"))
+
 (defn alpha-user?
   []
   (or config/dev?