OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use distinct(*) on aggregated journal to avoid duplicate raw journals
Oliver Güntherc6b9c8ff024d
diff --git a/app/models/journal/aggregated_journal.rb b/app/models/journal/aggregated_journal.rbindex daa5e03fec9..6ddc0a53c39 100644--- a/app/models/journal/aggregated_journal.rb+++ b/app/models/journal/aggregated_journal.rb@@ -63,7 +63,9 @@ class Journal::AggregatedJournal# The +until_version+ parameter can be used in conjunction with the +journable+ parameter# to see the aggregated journals as if no versions were known after the specified version.def aggregated_journals(journable: nil, sql: nil, until_version: nil, includes: [])- raw_journals = Journal::Scopes::AggregatedJournal.fetch(journable: journable, sql: sql, until_version: until_version)+ raw_journals = Journal::Scopes::AggregatedJournal+ .fetch(journable: journable, sql: sql, until_version: until_version)+ .order('version ASC')aggregated_journals = map_to_aggregated_journals(raw_journals)preload_associations(journable, aggregated_journals, includes)diff --git a/app/models/journal/scopes/aggregated_journal.rb b/app/models/journal/scopes/aggregated_journal.rbindex b7801b28357..e4878dcef1b 100644--- a/app/models/journal/scopes/aggregated_journal.rb+++ b/app/models/journal/scopes/aggregated_journal.rb@@ -41,6 +41,7 @@ module Journal::Scopes# having to also use a CASE/COALESCE statement.Journal.from(select_sql(journals_preselection))+ .select("DISTINCT *")endprivatediff --git a/spec/features/work_packages/details/markdown/activity_comments_spec.rb b/spec/features/work_packages/details/markdown/activity_comments_spec.rbindex 243617b249e..69ac7f77ce9 100644--- a/spec/features/work_packages/details/markdown/activity_comments_spec.rb+++ b/spec/features/work_packages/details/markdown/activity_comments_spec.rb@@ -68,6 +68,34 @@ describe 'activity comments', js: true, with_mail: false doexpect(page).to have_selector('.user-comment > .message', count: 3)wp_page.expect_comment text: 'this is my second comment!1'++ expect(comment_field.editing?).to be false+ comment_field.activate!+ expect(comment_field.editing?).to be true++ comment_field.click_and_type_slowly 'this is my third comment!1'+ comment_field.submit_by_click++ # Only shows three most recent+ expect(page).to have_selector('.user-comment > .message', count: 3)+ wp_page.expect_comment text: 'this is my third comment!1'++ wp_page.switch_to_tab tab: 'Activity'+ # Now showing all comments+ expect(page).to have_selector('.user-comment > .message', count: 4, wait: 10)++ expect(comment_field.editing?).to be false+ comment_field.activate!+ expect(comment_field.editing?).to be true++ comment_field.click_and_type_slowly 'this is my fifth comment!1'+ comment_field.submit_by_click++ expect(page).to have_selector('.user-comment > .message', count: 4)+ wp_page.expect_comment text: 'this is my fifth comment!1'++ # Expect no activity details+ expect(page).to have_no_selector('.work-package-details-activities-messages li')endend