Commit 9062e315 authored by Himanshu Kapoor's avatar Himanshu Kapoor

Skip wiki page events if title is missing

parent 8a65ba1f
......@@ -151,6 +151,8 @@ module Gitlab
end
def gitaly_find_page(title:, version: nil, dir: nil)
return unless title.present?
wiki_page, version = gitaly_wiki_client.find_page(title: title, version: version, dir: dir)
return unless wiki_page
......
......@@ -744,13 +744,19 @@ RSpec.describe Event do
describe '#wiki_page and #wiki_page?' do
context 'for a wiki page event' do
let(:wiki_page) do
create(:wiki_page, project: project)
end
let(:wiki_page) { create(:wiki_page, project: project) }
subject(:event) { create(:wiki_page_event, project: project, wiki_page: wiki_page) }
it { is_expected.to have_attributes(wiki_page?: be_truthy, wiki_page: wiki_page) }
context 'title is empty' do
before do
expect(event.target).to receive(:canonical_slug).and_return('')
end
it { is_expected.to have_attributes(wiki_page?: be_truthy, wiki_page: nil) }
end
end
context 'for any other event' 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