Commit 764124c3 authored by Sytse Sijbrandij's avatar Sytse Sijbrandij

Merge branch 'revert_touch' into 'master'

Revert "Update noteable after a new note is added"

This reverts commit fbdaf0e2.

https://gitlab.com/gitlab-org/gitlab-ce/issues/2027

See merge request !1094
parents c8d00787 6353ca9a
...@@ -31,7 +31,7 @@ class Note < ActiveRecord::Base ...@@ -31,7 +31,7 @@ class Note < ActiveRecord::Base
participant :author, :mentioned_users participant :author, :mentioned_users
belongs_to :project belongs_to :project
belongs_to :noteable, polymorphic: true, touch: true belongs_to :noteable, polymorphic: true
belongs_to :author, class_name: "User" belongs_to :author, class_name: "User"
delegate :name, to: :project, prefix: true delegate :name, to: :project, prefix: true
......
...@@ -36,7 +36,6 @@ describe 'Gitlab::NoteDataBuilder' do ...@@ -36,7 +36,6 @@ describe 'Gitlab::NoteDataBuilder' do
let(:note) { create(:note_on_issue, noteable_id: issue.id) } let(:note) { create(:note_on_issue, noteable_id: issue.id) }
it 'returns the note and issue-specific data' do it 'returns the note and issue-specific data' do
data[:issue]["updated_at"] = fixed_time
expect(data).to have_key(:issue) expect(data).to have_key(:issue)
expect(data[:issue]).to eq(issue.hook_attrs) expect(data[:issue]).to eq(issue.hook_attrs)
end end
...@@ -47,7 +46,6 @@ describe 'Gitlab::NoteDataBuilder' do ...@@ -47,7 +46,6 @@ describe 'Gitlab::NoteDataBuilder' do
let(:note) { create(:note_on_merge_request, noteable_id: merge_request.id) } let(:note) { create(:note_on_merge_request, noteable_id: merge_request.id) }
it 'returns the note and merge request data' do it 'returns the note and merge request data' do
data[:merge_request]["updated_at"] = fixed_time
expect(data).to have_key(:merge_request) expect(data).to have_key(:merge_request)
expect(data[:merge_request]).to eq(merge_request.hook_attrs) expect(data[:merge_request]).to eq(merge_request.hook_attrs)
end end
...@@ -58,7 +56,6 @@ describe 'Gitlab::NoteDataBuilder' do ...@@ -58,7 +56,6 @@ describe 'Gitlab::NoteDataBuilder' do
let(:note) { create(:note_on_merge_request_diff, noteable_id: merge_request.id) } let(:note) { create(:note_on_merge_request_diff, noteable_id: merge_request.id) }
it 'returns the note and merge request diff data' do it 'returns the note and merge request diff data' do
data[:merge_request]["updated_at"] = fixed_time
expect(data).to have_key(:merge_request) expect(data).to have_key(:merge_request)
expect(data[:merge_request]).to eq(merge_request.hook_attrs) expect(data[:merge_request]).to eq(merge_request.hook_attrs)
end end
...@@ -69,7 +66,6 @@ describe 'Gitlab::NoteDataBuilder' do ...@@ -69,7 +66,6 @@ describe 'Gitlab::NoteDataBuilder' do
let!(:note) { create(:note_on_project_snippet, noteable_id: snippet.id) } let!(:note) { create(:note_on_project_snippet, noteable_id: snippet.id) }
it 'returns the note and project snippet data' do it 'returns the note and project snippet data' do
data[:snippet]["updated_at"] = fixed_time
expect(data).to have_key(:snippet) expect(data).to have_key(:snippet)
expect(data[:snippet]).to eq(snippet.hook_attrs) expect(data[:snippet]).to eq(snippet.hook_attrs)
end end
......
...@@ -22,7 +22,7 @@ require 'spec_helper' ...@@ -22,7 +22,7 @@ require 'spec_helper'
describe Note do describe Note do
describe 'associations' do describe 'associations' do
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:noteable).touch(true) } it { is_expected.to belong_to(:noteable) }
it { is_expected.to belong_to(:author).class_name('User') } it { is_expected.to belong_to(:author).class_name('User') }
end end
......
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