Commit 4b4ed315 authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-04-09

# Conflicts:
#	app/assets/javascripts/boards/components/board.js

[ci skip]
parents c105ce64 de36ca81
...@@ -20,7 +20,10 @@ gl.issueBoards.Board = Vue.extend({ ...@@ -20,7 +20,10 @@ gl.issueBoards.Board = Vue.extend({
boardList, boardList,
'board-delete': gl.issueBoards.BoardDelete, 'board-delete': gl.issueBoards.BoardDelete,
BoardBlankState, BoardBlankState,
<<<<<<< HEAD
boardPromotionState, boardPromotionState,
=======
>>>>>>> upstream/master
}, },
props: { props: {
list: Object, list: Object,
......
...@@ -1015,7 +1015,7 @@ class User < ActiveRecord::Base ...@@ -1015,7 +1015,7 @@ class User < ActiveRecord::Base
def ci_authorized_runners def ci_authorized_runners
@ci_authorized_runners ||= begin @ci_authorized_runners ||= begin
runner_ids = Ci::RunnerProject runner_ids = Ci::RunnerProject
.where("ci_runner_projects.project_id IN (#{ci_projects_union.to_sql})") # rubocop:disable GitlabSecurity/SqlInjection .where(project: authorized_projects(Gitlab::Access::MASTER))
.select(:runner_id) .select(:runner_id)
Ci::Runner.specific.where(id: runner_ids) Ci::Runner.specific.where(id: runner_ids)
end end
...@@ -1226,15 +1226,6 @@ class User < ActiveRecord::Base ...@@ -1226,15 +1226,6 @@ class User < ActiveRecord::Base
], remove_duplicates: false) ], remove_duplicates: false)
end end
def ci_projects_union
scope = { access_level: [Gitlab::Access::MASTER, Gitlab::Access::OWNER] }
groups = groups_projects.where(members: scope)
other = projects.where(members: scope)
Gitlab::SQL::Union.new([personal_projects.select(:id), groups.select(:id),
other.select(:id)])
end
# Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration # Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration
def send_devise_notification(notification, *args) def send_devise_notification(notification, *args)
return true unless can?(:receive_notifications) return true unless can?(:receive_notifications)
......
...@@ -54,8 +54,7 @@ module NotificationRecipientService ...@@ -54,8 +54,7 @@ module NotificationRecipientService
users = users.includes(:notification_settings) users = users.includes(:notification_settings)
end end
users = Array(users) users = Array(users).compact
users.compact!
recipients.concat(users.map { |u| make_recipient(u, type, reason) }) recipients.concat(users.map { |u| make_recipient(u, type, reason) })
end end
......
---
title: 'Allow group owner to enable runners from subgroups (#41981)'
merge_request: 18009
author:
type: fixed
---
title: Detect repository license on Gitaly by default
merge_request:
author:
type: performance
...@@ -74,6 +74,24 @@ See the [Rails guides] for more info. ...@@ -74,6 +74,24 @@ See the [Rails guides] for more info.
1. Reply by email should now be working. 1. Reply by email should now be working.
## Email namespace
If you need to implement a new feature which requires a new email handler, follow these rules:
- You must choose a namespace. The namespace cannot contain `/` or `+`, and cannot match `\h{16}`.
- If your feature is related to a project, you will append the namespace **after** the project path, separated by a `+`
- If you have different actions in the namespace, you add the actions **after** the namespace separated by a `+`. The action name cannot contain `/` or `+`, , and cannot match `\h{16}`.
- You will register your handlers in `lib/gitlab/email/handler.rb`
Therefore, these are the only valid formats for an email handler:
- `path/to/project+namespace`
- `path/to/project+namespace+action`
- `namespace`
- `namespace+action`
Please note that `path/to/project` is used in GitLab Premium as handler for the Service Desk feature.
--- ---
[Return to Development documentation](README.md) [Return to Development documentation](README.md)
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
end end
def can_handle? def can_handle?
!incoming_email_token.nil? !incoming_email_token.nil? && !incoming_email_token.include?("+") && !mail_key.include?(Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX)
end end
def execute def execute
......
...@@ -1049,7 +1049,8 @@ module Gitlab ...@@ -1049,7 +1049,8 @@ module Gitlab
end end
def license_short_name def license_short_name
gitaly_migrate(:license_short_name) do |is_enabled| gitaly_migrate(:license_short_name,
status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled|
if is_enabled if is_enabled
gitaly_repository_client.license_short_name gitaly_repository_client.license_short_name
else else
......
...@@ -14,4 +14,28 @@ describe Gitlab::Email::Handler do ...@@ -14,4 +14,28 @@ describe Gitlab::Email::Handler do
expect(described_class.for('email', '')).to be_nil expect(described_class.for('email', '')).to be_nil
end end
end end
describe 'regexps are set properly' do
let(:addresses) do
%W(sent_notification_key#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX} sent_notification_key path/to/project+merge-request+user_email_token path/to/project+user_email_token)
end
it 'picks each handler at least once' do
matched_handlers = addresses.map do |address|
described_class.for('email', address).class
end
expect(matched_handlers.uniq).to match_array(Gitlab::Email::Handler::HANDLERS)
end
it 'can pick exactly one handler for each address' do
addresses.each do |address|
matched_handlers = Gitlab::Email::Handler::HANDLERS.select do |handler|
handler.new('email', address).can_handle?
end
expect(matched_handlers.count).to eq(1), "#{address} matches #{matched_handlers.count} handlers: #{matched_handlers}"
end
end
end
end end
...@@ -1899,6 +1899,21 @@ describe User do ...@@ -1899,6 +1899,21 @@ describe User do
it_behaves_like :member it_behaves_like :member
end end
context 'with subgroup with different owner for project runner', :nested_groups do
let(:group) { create(:group) }
let(:another_user) { create(:user) }
let(:subgroup) { create(:group, parent: group) }
let(:project) { create(:project, group: subgroup) }
def add_user(access)
group.add_user(user, access)
group.add_user(another_user, :owner)
subgroup.add_user(another_user, :owner)
end
it_behaves_like :member
end
end end
describe '#projects_with_reporter_access_limited_to' do describe '#projects_with_reporter_access_limited_to' do
......
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