fix code broken on merge

This commit is contained in:
as-op
2026-02-25 16:04:08 +01:00
parent 2f18dea69e
commit e7b2cc440a
3 changed files with 26 additions and 20 deletions
+2 -2
View File
@@ -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)
+7 -1
View File
@@ -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?
@@ -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