Commit 18e78d23 authored by Max Woolf's avatar Max Woolf

Remove substransaction from wiki event creation

Removes a use of `safe_find_or_create_by!` when
adding a wiki-related Event.

Changelog: fixed
parent 4ba24381
......@@ -10,11 +10,9 @@ module WikiPages
end
def execute(slug, page, action, event_fingerprint)
event = Event.transaction do
wiki_page_meta = WikiPage::Meta.find_or_create(slug, page)
::EventCreateService.new.wiki_event(wiki_page_meta, author, action, event_fingerprint)
end
event = ::EventCreateService.new.wiki_event(wiki_page_meta, author, action, event_fingerprint)
ServiceResponse.success(payload: { event: event })
rescue ::EventCreateService::IllegalActionError, ::ActiveRecord::ActiveRecordError => e
......
......@@ -34,10 +34,6 @@ RSpec.describe WikiPages::EventCreateService do
it 'does not create an event' do
expect { response }.not_to change(Event, :count)
end
it 'does not create a metadata record' do
expect { response }.not_to change(WikiPage::Meta, :count)
end
end
it 'returns a successful response' 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