]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5630 The permalink to a deleted profile should display a nice message
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 7 Oct 2014 12:17:48 +0000 (14:17 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 7 Oct 2014 12:17:56 +0000 (14:17 +0200)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 008f76db170fb1cc9b37a2907738d065afe4c971..b6a5ba9f4e227c30c71fdc5cf6ec9f21e21a3c01 100644 (file)
@@ -40,11 +40,16 @@ class ProfilesController < ApplicationController
     require_parameters 'key'
     call_backend do
       @profile = Internal.qprofile_loader.getByKey(params[:key])
-      not_found('Profile not found') unless @profile
-      @deprecated_active_rules = Internal.qprofile_loader.countDeprecatedActiveRulesByProfile(@profile.getKey())
-      @stats = Internal.qprofile_loader.getStatsByProfile(@profile.getKey())
+      if @profile
+        @deprecated_active_rules = Internal.qprofile_loader.countDeprecatedActiveRulesByProfile(@profile.getKey())
+        @stats = Internal.qprofile_loader.getStatsByProfile(@profile.getKey())
+        set_profile_breadcrumbs
+      else
+        # SONAR-5630
+        flash[:error] = message('quality_profiles.deleted_profile', :params => params[:key])
+        redirect_to :controller => 'profiles', :action => 'index'
+      end
     end
-    set_profile_breadcrumbs
   end
 
   # GET /profiles/create_form?language=<language>
index 2f6077c178d9836c3192dd54256110c0029575ff..0a775d01a6cdc7f57a4b841f52cf21dad35a7e8a 100644 (file)
@@ -1654,6 +1654,7 @@ quality_profiles.changelog.activated=Activated
 quality_profiles.changelog.deactivated=Deactivated
 quality_profiles.changelog.updated=Updated
 quality_profiles.changelog.parameter_reset_to_default_value_x=Parameter <b>{0}</b> reset to default value
+quality_profiles.deleted_profile=The profile {0} doesn't exists anymore
 
 
 #------------------------------------------------------------------------------