[30415] Fix missing project reference in journal

https://community.openproject.com/wp/30415
pull/7415/head
Oliver Günther 5 years ago
parent e570d77e08
commit 4666fbb4e0
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 1
      app/models/journal/aggregated_journal.rb
  2. 1
      lib/open_project/text_formatting/matchers/link_handlers/revisions.rb
  3. 26
      spec/features/work_packages/tabs/activity_revisions_spec.rb
  4. 4
      spec/models/journal/aggregated_journal_spec.rb

@ -365,6 +365,7 @@ class Journal::AggregatedJournal
:editable_by?,
:notes_id,
:notes_version,
:project,
:data,
:data=,
to: :journal

@ -46,6 +46,7 @@ module OpenProject::TextFormatting::Matchers
def call
# don't handle link unless repository exists
return nil unless project && project.repository
changeset = Changeset.visible.find_by(repository_id: project.repository.id, revision: matcher.identifier)
# don't handle link unless changeset can be seen

@ -93,14 +93,14 @@ describe 'Activity tab', js: true, selenium: true do
end
date_selector = ".work-package-details-activities-activity:nth-of-type(#{actual_index}) " +
'.activity-date'
'.activity-date'
# Do not use :long format to match the printed date without double spaces
# on the first 9 days of the month
expected_date = if activity.is_a?(Journal)
activity.created_at
else
activity.committed_on
end.to_date.strftime("%B %-d, %Y")
activity.created_at
else
activity.committed_on
end.to_date.strftime("%B %-d, %Y")
expect(page).to have_selector(date_selector,
text: expected_date)
@ -193,6 +193,22 @@ describe 'Activity tab', js: true, selenium: true do
expect(page).to have_selector('.user-comment > .message', count: 3)
expect(page).to have_selector('.user-comment > .message blockquote')
end
it 'can reference a changeset (Regression #30415)' do
work_package_page.visit_tab! 'activity'
work_package_page.ensure_page_loaded
expect(page).to have_selector('.user-comment > .message', text: initial_comment)
comment_field = WorkPackageEditorField.new work_package_page,
'comment',
selector: '.work-packages--activity--add-comment'
comment_field.activate!
comment_field.click_and_type_slowly "References r#{revision.revision}"
comment_field.submit_by_click
expect(page).to have_selector('.user-comment .message a', text: revision.revision)
end
end
context 'with no permission' do

@ -94,6 +94,10 @@ describe Journal::AggregatedJournal, type: :model do
expect(subject.first.successor).to be_nil
end
it 'forwards project to the journable' do
expect(subject.first.project).to eq(work_package.project)
end
context 'WP updated immediately after uncommented change' do
let(:notes) { nil }

Loading…
Cancel
Save