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

Small code fixes

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