Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-06 06:08:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-06 06:08:47 +0300
commitcfbaef3f1c28cdb9b15615215b87167181cb210f (patch)
tree8713f67e889a9b6d89fd35584ec7405f5a379565 /app
parenta97acfe57aac7d8206e99e5ffdfe9c5fb5b69544 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/controllers/profiles/notifications_controller.rb3
-rw-r--r--app/models/notification_setting.rb2
-rw-r--r--app/services/audit_event_service.rb2
3 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb
index d295b64082c..064b2a2cc12 100644
--- a/app/controllers/profiles/notifications_controller.rb
+++ b/app/controllers/profiles/notifications_controller.rb
@@ -4,13 +4,14 @@ class Profiles::NotificationsController < Profiles::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def show
@user = current_user
- @group_notifications = current_user.notification_settings.for_groups.order(:id)
+ @group_notifications = current_user.notification_settings.preload_source_route.for_groups.order(:id)
@group_notifications += GroupsFinder.new(
current_user,
all_available: false,
exclude_group_ids: @group_notifications.select(:source_id)
).execute.map { |group| current_user.notification_settings_for(group, inherit: true) }
@project_notifications = current_user.notification_settings.for_projects.order(:id)
+ .preload_source_route
.select { |notification| current_user.can?(:read_project, notification.source) }
@global_notification_setting = current_user.global_notification_setting
end
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb
index 1447f822513..e2c362538eb 100644
--- a/app/models/notification_setting.rb
+++ b/app/models/notification_setting.rb
@@ -27,6 +27,8 @@ class NotificationSetting < ApplicationRecord
.where.not(projects: { pending_delete: true })
end
+ scope :preload_source_route, -> { preload(source: [:route]) }
+
EMAIL_EVENTS = [
:new_release,
:new_note,
diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb
index 40761ee97d2..9fd892ead82 100644
--- a/app/services/audit_event_service.rb
+++ b/app/services/audit_event_service.rb
@@ -44,6 +44,8 @@ class AuditEventService
end
def log_security_event_to_database
+ return if Gitlab::Database.read_only?
+
SecurityEvent.create(base_payload.merge(details: @details))
end
end