]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-23654 Dismiss tour for any non-admin user on the first login
authorViktor Vorona <viktor.vorona@sonarsource.com>
Mon, 25 Nov 2024 12:44:32 +0000 (13:44 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 26 Nov 2024 20:02:51 +0000 (20:02 +0000)
server/sonar-web/src/main/js/app/components/ModeTour.tsx

index 8a9f745a1e74a25f4af1f472e75c60e556ef33d5..74b9bc89cca72fa3251cf1ea7265d09d349d6118 100644 (file)
@@ -95,6 +95,13 @@ export default function ModeTour() {
   const isAdmin = currentUser.permissions?.global.includes(Permissions.Admin);
   const isAdminOrQGAdmin =
     isAdmin || currentUser.permissions?.global.includes(Permissions.QualityGateAdmin);
+  const dismissedTour = currentUser.dismissedNotices[NoticeType.MODE_TOUR];
+
+  useEffect(() => {
+    if (currentUser.isLoggedIn && !isAdminOrQGAdmin && !dismissedTour) {
+      dismissTour();
+    }
+  }, [currentUser.isLoggedIn, isAdminOrQGAdmin, dismissedTour]);
 
   if (!runManually && (currentUser.dismissedNotices[NoticeType.MODE_TOUR] || !isAdminOrQGAdmin)) {
     return null;