aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>2013-02-01 10:23:25 +0100
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>2013-02-01 10:23:25 +0100
commiteb79a1381ef94aab674fdce313eec25e4f0f3140 (patch)
treeec2d89307c3088484603bf66df8c8b9fb29670c8 /sonar-server
parente725eef7d297187f9c356c9e85eee858eece3bf8 (diff)
parent56198b02a595a5f8b0cc41c45cb51dd7db9fd694 (diff)
downloadsonarqube-eb79a1381ef94aab674fdce313eec25e4f0f3140.tar.gz
sonarqube-eb79a1381ef94aab674fdce313eec25e4f0f3140.zip
Merge branch 'current'
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
index adff2d48ca5..47e81d1c9d2 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb
@@ -103,28 +103,34 @@ class AccountController < ApplicationController
end
def load_notification_properties
+ channel_keys = @channels.map {|c| c.getKey()}
+
Property.find(:all, :conditions => ['prop_key like ? AND user_id = ?', 'notification.%', current_user.id]).each do |property|
r_id = property.resource_id
if r_id
# This is a per-project notif
- project_notifs = @per_project_notifications[r_id]
- unless project_notifs
- project_notifs = {}
- @per_project_dispatchers.each do |dispatcher|
- project_notifs[dispatcher] = []
- end
- @per_project_notifications[r_id] = project_notifs
- end
parts = property.key.split('.')
dispatcher_key = parts[1]
channel_key = parts[2]
- project_notifs[dispatcher_key] << channel_key
+ if @per_project_dispatchers.include?(dispatcher_key) && channel_keys.include?(channel_key)
+ project_notifs = get_project_notifications(r_id)
+ project_notifs[dispatcher_key] << channel_key
+ end
else
# This is a global notif
@global_notifications[property.key.sub('notification.', '')] = true
end
end
end
+
+ def get_project_notifications(resource_id)
+ project_notifs = @per_project_notifications[resource_id]
+ unless project_notifs
+ project_notifs = init_project_notifications
+ @per_project_notifications[resource_id] = project_notifs
+ end
+ project_notifs
+ end
def init_project_notifications
project_notifs = {}