Commit bbcc65ea authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents b5e8c205 6050b348
......@@ -43,7 +43,7 @@ class IssuableFinder
FILTER_NONE = 'none'.freeze
FILTER_ANY = 'any'.freeze
# This is accepted as a deprecated filter and is also used in unassigning users
# This is used in unassigning users
NONE = '0'.freeze
attr_accessor :current_user, :params
......@@ -248,8 +248,7 @@ class IssuableFinder
def filter_by_no_label?
downcased = label_names.map(&:downcase)
# Label::NONE is deprecated and should be removed in 12.0
downcased.include?(FILTER_NONE) || downcased.include?(Label::NONE)
downcased.include?(FILTER_NONE)
end
def filter_by_any_label?
......@@ -449,8 +448,7 @@ class IssuableFinder
# rubocop: enable CodeReuse/ActiveRecord
def filter_by_no_assignee?
# Assignee_id takes precedence over assignee_username
[NONE, FILTER_NONE].include?(params[:assignee_id].to_s.downcase) || params[:assignee_username].to_s == NONE
params[:assignee_id].to_s.downcase == FILTER_NONE
end
def filter_by_any_assignee?
......
......@@ -17,13 +17,11 @@ class BroadcastMessage < ApplicationRecord
default_value_for :font, '#FFFFFF'
CACHE_KEY = 'broadcast_message_current_json'.freeze
LEGACY_CACHE_KEY = 'broadcast_message_current'.freeze
after_commit :flush_redis_cache
def self.current
messages = cache.fetch(CACHE_KEY, as: BroadcastMessage, expires_in: cache_expires_in) do
remove_legacy_cache_key
current_and_future_messages
end
......@@ -50,14 +48,6 @@ class BroadcastMessage < ApplicationRecord
nil
end
# This can be removed in GitLab 12.0+
# The old cache key had an indefinite lifetime, and in an HA
# environment a one-shot migration would not work because the cache
# would be repopulated by a node that has not been upgraded.
def self.remove_legacy_cache_key
cache.expire(LEGACY_CACHE_KEY)
end
def active?
started? && !ended?
end
......@@ -84,7 +74,6 @@ class BroadcastMessage < ApplicationRecord
def flush_redis_cache
self.class.cache.expire(CACHE_KEY)
self.class.remove_legacy_cache_key
end
end
......
......@@ -13,7 +13,6 @@ class Label < ApplicationRecord
cache_markdown_field :description, pipeline: :single_line
DEFAULT_COLOR = '#428BCA'
NONE = 'no label'
default_value_for :color, DEFAULT_COLOR
......
......@@ -14,6 +14,9 @@ module AutoMerge
yield if block_given?
# Notify the event that auto merge is enabled or merge param is updated
AutoMergeProcessWorker.perform_async(merge_request.id)
strategy.to_sym
end
......
......@@ -210,7 +210,7 @@ describe 'Issues' do
let(:issue) { @issue }
it 'allows filtering by issues with no specified assignee' do
visit project_issues_path(project, assignee_id: IssuableFinder::NONE)
visit project_issues_path(project, assignee_id: IssuableFinder::FILTER_NONE)
expect(page).to have_content 'foobar'
expect(page).not_to have_content 'barbaz'
......
......@@ -33,7 +33,7 @@ describe 'Merge requests > User lists merge requests' do
end
it 'filters on no assignee' do
visit_merge_requests(project, assignee_id: IssuableFinder::NONE)
visit_merge_requests(project, assignee_id: IssuableFinder::FILTER_NONE)
expect(current_path).to eq(project_merge_requests_path(project))
expect(page).to have_content 'merge-test'
......
......@@ -241,14 +241,6 @@ describe IssuesFinder do
end
end
context 'filtering by legacy No+Label' do
let(:params) { { label_name: Label::NONE } }
it 'returns issues with no labels' do
expect(issues).to contain_exactly(issue1, issue3, issue4)
end
end
context 'filtering by any label' do
let(:params) { { label_name: described_class::FILTER_ANY } }
......
......@@ -88,13 +88,6 @@ describe BroadcastMessage do
expect(Rails.cache).not_to receive(:delete).with(described_class::CACHE_KEY)
expect(described_class.current.length).to eq(0)
end
it 'clears the legacy cache key' do
create(:broadcast_message, :future)
expect(Rails.cache).to receive(:delete).with(described_class::LEGACY_CACHE_KEY)
expect(described_class.current.length).to eq(0)
end
end
describe '#attributes' do
......@@ -164,7 +157,6 @@ describe BroadcastMessage do
message = create(:broadcast_message)
expect(Rails.cache).to receive(:delete).with(described_class::CACHE_KEY)
expect(Rails.cache).to receive(:delete).with(described_class::LEGACY_CACHE_KEY)
message.flush_redis_cache
end
......
......@@ -273,14 +273,6 @@ describe API::Issues do
expect_paginated_array_response(issue2.id)
end
it 'returns issues with no assignee' do
issue2 = create(:issue, author: user2, project: project)
get api('/issues', user), params: { assignee_id: 0, scope: 'all' }
expect_paginated_array_response(issue2.id)
end
it 'returns issues with no assignee' do
issue2 = create(:issue, author: user2, project: project)
......@@ -496,18 +488,6 @@ describe API::Issues do
expect_paginated_array_response(closed_issue.id)
end
it 'returns an array of issues with no label when using the legacy No+Label filter' do
get api('/issues', user), params: { labels: 'No Label' }
expect_paginated_array_response(closed_issue.id)
end
it 'returns an array of issues with no label when using the legacy No+Label filter with labels param as array' do
get api('/issues', user), params: { labels: ['No Label'] }
expect_paginated_array_response(closed_issue.id)
end
end
it 'returns an empty array if no issue matches milestone' do
......
......@@ -12,6 +12,10 @@ describe AutoMerge::BaseService do
describe '#execute' do
subject { service.execute(merge_request) }
before do
allow(AutoMergeProcessWorker).to receive(:perform_async) {}
end
it 'sets properies to the merge request' do
subject
......@@ -65,6 +69,12 @@ describe AutoMerge::BaseService do
it 'returns activated strategy name' do
is_expected.to eq(AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS.to_sym)
end
it 'calls AutoMergeProcessWorker' do
expect(AutoMergeProcessWorker).to receive(:perform_async).with(merge_request.id).once
subject
end
end
context 'when failed to save' do
......
......@@ -19,12 +19,6 @@ shared_examples 'no assignee filter' do
expect(issuables).to contain_exactly(*expected_issuables)
end
it 'returns issuables not assigned to any assignee' do
params[:assignee_id] = 0
expect(issuables).to contain_exactly(*expected_issuables)
end
it 'returns issuables not assigned to any assignee' do
params[:assignee_id] = 'none'
......
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