Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /app/services/work_items/export_csv_service.rb
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'app/services/work_items/export_csv_service.rb')
-rw-r--r--app/services/work_items/export_csv_service.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/app/services/work_items/export_csv_service.rb b/app/services/work_items/export_csv_service.rb
index 9bef75e2c40..ee20a2832ce 100644
--- a/app/services/work_items/export_csv_service.rb
+++ b/app/services/work_items/export_csv_service.rb
@@ -11,24 +11,38 @@ module WorkItems
end
def email(mail_to_user)
- # TODO - will be implemented as part of https://gitlab.com/gitlab-org/gitlab/-/issues/379082
+ Notify.export_work_items_csv_email(mail_to_user, resource_parent, csv_data, csv_builder.status).deliver_now
end
private
def associations_to_preload
- [:work_item_type, :author]
+ [:project, [work_item_type: :enabled_widget_definitions], :author]
end
def header_to_value_hash
{
'Id' => 'iid',
'Title' => 'title',
+ 'Description' => ->(work_item) { get_widget_value_for(work_item, :description) },
'Type' => ->(work_item) { work_item.work_item_type.name },
'Author' => 'author_name',
'Author Username' => ->(work_item) { work_item.author.username },
'Created At (UTC)' => ->(work_item) { work_item.created_at.to_s(:csv) }
}
end
+
+ def get_widget_value_for(work_item, field)
+ widget_name = field_to_widget_map[field]
+ widget = work_item.get_widget(widget_name)
+
+ widget.try(field)
+ end
+
+ def field_to_widget_map
+ {
+ description: :description
+ }
+ end
end
end