diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-21 14:34:21 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-21 14:34:21 +0000 |
commit | 646aae3e4f0f9c547397fdf55cc2205b0171b565 (patch) | |
tree | b104fea646934ce06128fa9f616e694a0e3382a8 | |
parent | 9316bb2b4cabdb026fbcf0489bbb806d8bea986e (diff) | |
parent | 4bfdf8406f064b9499a1dbb5e4e5abcd0616ffe0 (diff) | |
download | gitlab-ce-646aae3e4f0f9c547397fdf55cc2205b0171b565.tar.gz |
Merge branch 'sh-fix-atom-feeds' into 'master'
Fix 500 errors in Atom feeds due to push events
Closes #36705
See merge request !13695
-rw-r--r-- | app/models/event.rb | 10 | ||||
-rw-r--r-- | spec/features/atom/users_spec.rb | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index f2a560a6b56..15ee170ca75 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -83,6 +83,10 @@ class Event < ActiveRecord::Base self.inheritance_column = 'action' class << self + def model_name + ActiveModel::Name.new(self, nil, 'event') + end + def find_sti_class(action) if action.to_i == PUSHED PushEvent @@ -438,6 +442,12 @@ class Event < ActiveRecord::Base EventForMigration.create!(new_attributes) end + def to_partial_path + # We are intentionally using `Event` rather than `self.class` so that + # subclasses also use the `Event` implementation. + Event._to_partial_path + end + private def recent_update? diff --git a/spec/features/atom/users_spec.rb b/spec/features/atom/users_spec.rb index 79069bbca8e..9ce687afb31 100644 --- a/spec/features/atom/users_spec.rb +++ b/spec/features/atom/users_spec.rb @@ -41,6 +41,8 @@ describe "User Feed" do target_project: project, description: "Here is the fix: ![an image](image.png)") end + let(:push_event) { create(:push_event, project: project, author: user) } + let!(:push_event_payload) { create(:push_event_payload, event: push_event) } before do project.team << [user, :master] @@ -70,6 +72,10 @@ describe "User Feed" do it 'has XHTML summaries in merge request descriptions' do expect(body).to match /Here is the fix: <a[^>]*><img[^>]*\/><\/a>/ end + + it 'has push event commit ID' do + expect(body).to have_content(Commit.truncate_sha(push_event.commit_id)) + end end end |