From e7b2cc440a5ff14ff88c9e7a7f310579f4e98fa4 Mon Sep 17 00:00:00 2001 From: as-op Date: Wed, 25 Feb 2026 16:04:08 +0100 Subject: [PATCH] fix code broken on merge --- app/services/import/jira_import_journals.rb | 4 +-- lib/open_project/journal_formatter/cause.rb | 8 ++++- .../import/jira_import_journals_spec.rb | 34 +++++++++---------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/services/import/jira_import_journals.rb b/app/services/import/jira_import_journals.rb index 1ba7353b32c..528aac780f6 100644 --- a/app/services/import/jira_import_journals.rb +++ b/app/services/import/jira_import_journals.rb @@ -70,8 +70,8 @@ module Import private - def same_minute?(a, b) - Time.zone.parse(a.to_s).change(sec: 0) == Time.zone.parse(b.to_s).change(sec: 0) + def same_minute?(first, second) + Time.zone.parse(first.to_s).change(sec: 0) == Time.zone.parse(second.to_s).change(sec: 0) end def group_history_entries(history) diff --git a/lib/open_project/journal_formatter/cause.rb b/lib/open_project/journal_formatter/cause.rb index ec4a0f8f107..7170681b76b 100644 --- a/lib/open_project/journal_formatter/cause.rb +++ b/lib/open_project/journal_formatter/cause.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -184,9 +186,13 @@ class OpenProject::JournalFormatter::Cause < JournalFormatter::Base to_string = h(item["toString"]) field = html? ? content_tag(:strong, field_label) : field_label + import_field_change_message(field, from_string, to_string) + end + + def import_field_change_message(field, from_string, to_string) if from_string.present? && to_string.present? I18n.t("journals.cause_descriptions.import.field_changed", - field:, old_value: from_string, new_value: to_string) + field:, old_value: from_string, new_value: to_string) elsif to_string.present? I18n.t("journals.cause_descriptions.import.field_set", field:, value: to_string) elsif from_string.present? diff --git a/spec/services/import/jira_import_journals_spec.rb b/spec/services/import/jira_import_journals_spec.rb index fb141936cab..a99a8e240f5 100644 --- a/spec/services/import/jira_import_journals_spec.rb +++ b/spec/services/import/jira_import_journals_spec.rb @@ -185,9 +185,9 @@ RSpec.describe Import::JiraImportJournals, "integration" do before do service.add_history(history: [ - history_entry(created: time1, author: "Alice", items: items1), - history_entry(created: time2, author: "Alice", items: items2) - ]) + history_entry(created: time1, author: "Alice", items: items1), + history_entry(created: time2, author: "Alice", items: items2) + ]) service.call end @@ -198,7 +198,7 @@ RSpec.describe Import::JiraImportJournals, "integration" do it "stores both items in the merged journal cause" do journal = work_package.journals.reload.last items = journal.cause_import_history.first["items"] - expect(items.map { _1["field"] }).to contain_exactly("assignee", "priority") + expect(items.pluck("field")).to contain_exactly("assignee", "priority") end end @@ -208,9 +208,9 @@ RSpec.describe Import::JiraImportJournals, "integration" do before do service.add_history(history: [ - history_entry(created: time1, author: "Alice"), - history_entry(created: time2, author: "Bob") - ]) + history_entry(created: time1, author: "Alice"), + history_entry(created: time2, author: "Bob") + ]) service.call end @@ -229,9 +229,9 @@ RSpec.describe Import::JiraImportJournals, "integration" do before do service.add_history(history: [ - history_entry(created: time1, author: "Alice", items: items1), - history_entry(created: time2, author: "Alice", items: items2) - ]) + history_entry(created: time1, author: "Alice", items: items1), + history_entry(created: time2, author: "Alice", items: items2) + ]) service.call end @@ -248,9 +248,9 @@ RSpec.describe Import::JiraImportJournals, "integration" do before do service.add_history(history: [ - history_entry(created: time1, author: "Alice", items: desc_item1), - history_entry(created: time2, author: "Alice", items: desc_item2) - ]) + history_entry(created: time1, author: "Alice", items: desc_item1), + history_entry(created: time2, author: "Alice", items: desc_item2) + ]) service.call end @@ -267,9 +267,9 @@ RSpec.describe Import::JiraImportJournals, "integration" do before do service.add_history(history: [ - history_entry(created: time1, author: "Alice", items: desc_item), - history_entry(created: time2, author: "Alice", items: status_item) - ]) + history_entry(created: time1, author: "Alice", items: desc_item), + history_entry(created: time2, author: "Alice", items: status_item) + ]) service.call end @@ -280,7 +280,7 @@ RSpec.describe Import::JiraImportJournals, "integration" do it "converts description content via Jira markup converter" do journal = work_package.journals.reload.last items = journal.cause_import_history.first["items"] - desc = items.find { _1["field"] == "description" } + desc = items.find { it["field"] == "description" } expect(desc).to be_present end end