Commit 7f6df32f authored by Felipe Artur's avatar Felipe Artur

Small code fixes

parent 7660e2fc
......@@ -2,9 +2,7 @@ module EE
module Issue
# override
def check_for_spam?
return true if author.support_bot?
super
author.support_bot? || super
end
# override
......@@ -27,9 +25,7 @@ module EE
# is not as bad as it seems, though, since it isn't
# permitted to :receive_notifications, and doesn't
# actually show up in the participants list.
return true if user == ::User.support_bot
super
::User.support_bot || super
end
end
end
......@@ -21,8 +21,8 @@ module EE
def support_bot
email_pattern = "support%s@#{Settings.gitlab.host}"
unique_internal(where(support_bot: true), 'support-bot', email) do |u|
u.bio = 'The GitLab support bot'
unique_internal(where(support_bot: true), 'support-bot', email_pattern) do |u|
u.bio = 'The GitLab support bot used for Service Desk'
u.name = 'GitLab Support Bot'
end
end
......@@ -52,6 +52,5 @@ module EE
def admin_or_auditor?
admin? || auditor?
end
end
end
......@@ -12,7 +12,7 @@ module EE
cannot! :push_code_to_protected_branches
end
if @user && @user.support_bot? && !@subject.service_desk_enabled?
if @user&.support_bot? && !@subject.service_desk_enabled?
cannot! :create_note
cannot! :read_project
end
......
......@@ -14,11 +14,12 @@ module EE
issue = note.noteable
reply_to = issue.service_desk_reply_to
support_bot = ::User.support_bot
return unless issue.service_desk_reply_to.present?
return unless issue.project.service_desk_enabled?
return if note.author == User.support_bot
return unless issue.subscribed?(::User.support_bot, issue.project)
return if note.author == support_bot
return unless issue.subscribed?(support_bot, issue.project)
Notify.service_desk_new_note_email(issue.id, note.id)
end
......
......@@ -30,10 +30,10 @@ module Gitlab
def project
return @project if instance_variable_defined?(:@project)
@project = Project.where(
@project = Project.find_by(
service_desk_enabled: true,
service_desk_mail_key: service_desk_key
).first
)
end
def create_issue!
......@@ -43,7 +43,7 @@ module Gitlab
@issue = Issues::CreateService.new(
project,
User.support_bot,
title: issue_title
title: issue_title,
description: message,
confidential: true,
service_desk_reply_to: from_address,
......
......@@ -5,7 +5,7 @@
module Gitlab
module LDAP
class Adapter
prepend EE::Gitlab::LDAP::Adapter
prepend ::EE::Gitlab::LDAP::Adapter
attr_reader :provider, :ldap
......
module Gitlab
module LDAP
class Person
include EE::Gitlab::LDAP::Person
include ::EE::Gitlab::LDAP::Person
# Active Directory-specific LDAP filter that checks if bit 2 of the
# userAccountControl attribute is set.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment