Commit 8ad16eb9 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'rmay-216344' into 'master'

Don't return target-specific broadcasts without a path supplied

See merge request gitlab-org/gitlab!46322
parents b5d4731d fa040bab
......@@ -103,6 +103,7 @@ class BroadcastMessage < ApplicationRecord
end
def matches_current_path(current_path)
return false if current_path.blank? && target_path.present?
return true if current_path.blank? || target_path.blank?
escaped = Regexp.escape(target_path).gsub('\\*', '.*')
......
---
title: Don't return target-specific broadcasts without a current path supplied
merge_request: 46322
author:
type: fixed
......@@ -161,6 +161,12 @@ RSpec.describe BroadcastMessage do
expect(subject.call('/group/issues/test').length).to eq(1)
end
it "does not return message if the target path is set but no current path is provided" do
create(:broadcast_message, target_path: "*/issues/*", broadcast_type: broadcast_type)
expect(subject.call.length).to eq(0)
end
end
describe '.current', :use_clean_rails_memory_store_caching 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