Skip to content

Commit e0b982b

Browse files
committed
[#72939] Jira import: status that doesn't exist on OP doesn't get assigned to the work package
https://community.openproject.org/work_packages/72939
1 parent c7d8171 commit e0b982b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

app/workers/import/jira_fetch_and_import_projects_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def import_user(jira_user, jira_import)
189189

190190
jira_user_groups.each do |group_name|
191191
call = Groups::CreateService
192-
.new(user: User.system)
192+
.new(user: User.system, contract_class: EmptyContract)
193193
.call(name: group_name)
194194
call.on_success do |result|
195195
group = result.result

app/workers/import/jira_import_projects_job.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def perform(jira_import_id)
7070
### PROJECT
7171
identifier = jira_project.payload.fetch("key").downcase
7272
service_call = Projects::CreateService
73-
.new(user:)
73+
.new(user:, contract_class: EmptyContract)
7474
.call(
7575
name: jira_project.payload.fetch("name"),
7676
identifier:,
@@ -152,6 +152,19 @@ def perform(jira_import_id)
152152
uses_existing:
153153
)
154154

155+
### Modify workfows for given role and type
156+
statuses = Status.all
157+
row = statuses.to_h do |status|
158+
[status.id.to_s, ["always"]]
159+
end
160+
status_params = statuses.to_h do |status|
161+
[status.id.to_s, row]
162+
end
163+
call = Workflows::BulkUpdateService
164+
.new(role: project_role, type:, tab: "always")
165+
.call(status_params)
166+
raise call.message if call.failure?
167+
155168
### PRIORITY
156169
issue_priority = jira_issue.payload["fields"]["priority"]
157170
priority = IssuePriority.where("LOWER(name) = LOWER(?)", issue_priority["name"]).first

spec/workers/import/jira_import_projects_job_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
payload: jira_project_payload)
5050
end
5151

52+
let!(:default_status) { create(:default_status) }
53+
5254
describe "#perform" do
5355
context "when a project with the same identifier already exists" do
5456
let!(:existing_project) { create(:project, identifier: "dyx", name: "Existing Project") }

0 commit comments

Comments
 (0)