From b10b59773f00c321c2b135f4cfbe289b990a53e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Wed, 24 Jul 2024 18:06:33 +0200 Subject: [PATCH 01/77] build: add env variable for database port --- .env | 1 + config/database.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.env b/.env index ac53801da..e4499b3f3 100644 --- a/.env +++ b/.env @@ -14,6 +14,7 @@ GOOD_JOB_EXECUTION_MODE= ADMIN_IDS= LOG_LEVEL= DB_HOST= +DB_PORT=5432 DB_USER= DB_PASSWORD= AUTO_SYNC_BOXES= # ON / OFF, default OFF diff --git a/config/database.yml b/config/database.yml index a09cf5d36..1b14a671c 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,6 +3,7 @@ default: &default encoding: unicode pool: 50 host: <%= ENV['DB_HOST'] %> + port: <%= ENV['DB_PORT'] %> username: <%= ENV['DB_USER'] %> password: <%= ENV['DB_PASSWORD'] %> From 30706c7ad1d3dcac3fb929762856b2e1ad1754a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Thu, 25 Jul 2024 13:42:25 +0200 Subject: [PATCH 02/77] build: remove default port from .env --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index e4499b3f3..cf2a364ce 100644 --- a/.env +++ b/.env @@ -14,7 +14,7 @@ GOOD_JOB_EXECUTION_MODE= ADMIN_IDS= LOG_LEVEL= DB_HOST= -DB_PORT=5432 +DB_PORT= DB_USER= DB_PASSWORD= AUTO_SYNC_BOXES= # ON / OFF, default OFF From 4cab1a359cd11d076ee1e2dae4a0862bddd55bf8 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 18 Sep 2024 13:50:55 +0200 Subject: [PATCH 03/77] Show sender name by FS MessageThreads --- .../message_threads_table_row_component.html.erb | 10 +++++++--- app/models/box.rb | 4 ++++ app/models/fs/box.rb | 4 ++++ app/models/upvs/box.rb | 4 ++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/components/message_threads_table_row_component.html.erb b/app/components/message_threads_table_row_component.html.erb index 34840364e..901c2e226 100644 --- a/app/components/message_threads_table_row_component.html.erb +++ b/app/components/message_threads_table_row_component.html.erb @@ -27,9 +27,13 @@
<% if @message_thread.sender || @message_thread.recipient %> - <% if @message_thread.is_outbox && @message_thread.recipient.present? %> - Komu: <%= @message_thread.recipient %> - <% elsif !@message_thread.is_outbox && @message_thread.sender.present? %> + <% if @message_thread.box.communication_to_multiple_subjects? %> + <% if @message_thread.is_outbox && @message_thread.recipient.present? %> + Komu: <%= @message_thread.recipient %> + <% elsif !@message_thread.is_outbox && @message_thread.sender.present? %> + Od: <%= @message_thread.sender %> + <% end %> + <% elsif @message_thread.sender.present? %> Od: <%= @message_thread.sender %> <% end %> diff --git a/app/models/box.rb b/app/models/box.rb index 82ae39da4..1d8c81dee 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -49,6 +49,10 @@ def self.sync_all find_each(&:sync) end + def communication_to_multiple_subjects? + raise NotImplementedError + end + private def validate_box_with_api_connection diff --git a/app/models/fs/box.rb b/app/models/fs/box.rb index 25a6a85a4..a40045149 100644 --- a/app/models/fs/box.rb +++ b/app/models/fs/box.rb @@ -40,6 +40,10 @@ def self.create_with_api_connection!(params) def sync end + def communication_to_multiple_subjects? + false + end + store_accessor :settings, :dic, prefix: true store_accessor :settings, :subject_id, prefix: true end diff --git a/app/models/upvs/box.rb b/app/models/upvs/box.rb index deebd46b8..e53489ee8 100644 --- a/app/models/upvs/box.rb +++ b/app/models/upvs/box.rb @@ -46,6 +46,10 @@ def sync Govbox::SyncBoxJob.perform_later(self) end + def communication_to_multiple_subjects? + true + end + private def validate_settings_obo From d44f66ee67cf93d52cffc90c43cc5a981b915f5b Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 18 Sep 2024 15:22:49 +0200 Subject: [PATCH 04/77] Update tests --- test/system/fs/message_drafts_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/system/fs/message_drafts_test.rb b/test/system/fs/message_drafts_test.rb index b1c0f3201..16926cdc0 100644 --- a/test/system/fs/message_drafts_test.rb +++ b/test/system/fs/message_drafts_test.rb @@ -70,7 +70,7 @@ class Fs::MessageDraftsTest < ApplicationSystemTestCase within_thread_in_listing(message1.thread) do assert_text "Podanie pre FS (Správa daní) - platné od 1.4.2024" - assert_text "Finančná správa" + assert_text "Od: #{message1.thread.box.name}" within_tags do assert_text "Rozpracované" @@ -79,7 +79,7 @@ class Fs::MessageDraftsTest < ApplicationSystemTestCase within_thread_in_listing(message2.thread) do assert_text "Vyhlásenie o poukázaní sumy do výšky 2% (3%) zaplatenej dane za zdaňovacie obdobie 2021" - assert_text "Finančná správa" + assert_text "Od: #{message2.thread.box.name}" within_tags do assert_text "Rozpracované" From df54689b5ccd17c261ec31c3bc100c7f4397c8e0 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Thu, 19 Sep 2024 17:22:57 +0200 Subject: [PATCH 05/77] Move logic to MessageThreadHelper --- .../message_threads_table_row_component.html.erb | 10 +++------- app/helpers/message_thread_helper.rb | 9 +++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 app/helpers/message_thread_helper.rb diff --git a/app/components/message_threads_table_row_component.html.erb b/app/components/message_threads_table_row_component.html.erb index 901c2e226..f4ee8b257 100644 --- a/app/components/message_threads_table_row_component.html.erb +++ b/app/components/message_threads_table_row_component.html.erb @@ -27,13 +27,9 @@
<% if @message_thread.sender || @message_thread.recipient %> - <% if @message_thread.box.communication_to_multiple_subjects? %> - <% if @message_thread.is_outbox && @message_thread.recipient.present? %> - Komu: <%= @message_thread.recipient %> - <% elsif !@message_thread.is_outbox && @message_thread.sender.present? %> - Od: <%= @message_thread.sender %> - <% end %> - <% elsif @message_thread.sender.present? %> + <% if MessageThreadHelper.show_recipient?(@message_thread) %> + Komu: <%= @message_thread.recipient %> + <% elsif MessageThreadHelper.show_sender?(@message_thread) %> Od: <%= @message_thread.sender %> <% end %> diff --git a/app/helpers/message_thread_helper.rb b/app/helpers/message_thread_helper.rb new file mode 100644 index 000000000..2e1231168 --- /dev/null +++ b/app/helpers/message_thread_helper.rb @@ -0,0 +1,9 @@ +module MessageThreadHelper + def self.show_recipient?(message_thread) + message_thread.box.communication_to_multiple_subjects? && message_thread.is_outbox && message_thread.recipient.present? + end + + def self.show_sender?(message_thread) + !message_thread.box.communication_to_multiple_subjects? || (!message_thread.is_outbox && message_thread.sender.present?) + end +end From 412e8f83d3e7d8ca2b7b5cc22325d8c81cb0d607 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 24 Sep 2024 12:20:49 +0200 Subject: [PATCH 06/77] Update method name --- app/helpers/message_thread_helper.rb | 4 ++-- app/models/box.rb | 2 +- app/models/fs/box.rb | 2 +- app/models/upvs/box.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/message_thread_helper.rb b/app/helpers/message_thread_helper.rb index 2e1231168..5dcd103e8 100644 --- a/app/helpers/message_thread_helper.rb +++ b/app/helpers/message_thread_helper.rb @@ -1,9 +1,9 @@ module MessageThreadHelper def self.show_recipient?(message_thread) - message_thread.box.communication_to_multiple_subjects? && message_thread.is_outbox && message_thread.recipient.present? + message_thread.box.single_recipient? && message_thread.is_outbox && message_thread.recipient.present? end def self.show_sender?(message_thread) - !message_thread.box.communication_to_multiple_subjects? || (!message_thread.is_outbox && message_thread.sender.present?) + !message_thread.box.single_recipient? || (!message_thread.is_outbox && message_thread.sender.present?) end end diff --git a/app/models/box.rb b/app/models/box.rb index 1d8c81dee..45492b1cd 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -49,7 +49,7 @@ def self.sync_all find_each(&:sync) end - def communication_to_multiple_subjects? + def single_recipient? raise NotImplementedError end diff --git a/app/models/fs/box.rb b/app/models/fs/box.rb index a40045149..96d1dcf48 100644 --- a/app/models/fs/box.rb +++ b/app/models/fs/box.rb @@ -40,7 +40,7 @@ def self.create_with_api_connection!(params) def sync end - def communication_to_multiple_subjects? + def single_recipient? false end diff --git a/app/models/upvs/box.rb b/app/models/upvs/box.rb index e53489ee8..f396fc753 100644 --- a/app/models/upvs/box.rb +++ b/app/models/upvs/box.rb @@ -46,7 +46,7 @@ def sync Govbox::SyncBoxJob.perform_later(self) end - def communication_to_multiple_subjects? + def single_recipient? true end From f2719903904db00cb50682d189125a79fc614163 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 24 Sep 2024 13:53:42 +0200 Subject: [PATCH 07/77] Fix --- app/helpers/message_thread_helper.rb | 4 ++-- app/models/fs/box.rb | 2 +- app/models/upvs/box.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/message_thread_helper.rb b/app/helpers/message_thread_helper.rb index 5dcd103e8..f036423a5 100644 --- a/app/helpers/message_thread_helper.rb +++ b/app/helpers/message_thread_helper.rb @@ -1,9 +1,9 @@ module MessageThreadHelper def self.show_recipient?(message_thread) - message_thread.box.single_recipient? && message_thread.is_outbox && message_thread.recipient.present? + !message_thread.box.single_recipient? && message_thread.is_outbox && message_thread.recipient.present? end def self.show_sender?(message_thread) - !message_thread.box.single_recipient? || (!message_thread.is_outbox && message_thread.sender.present?) + message_thread.box.single_recipient? || (!message_thread.is_outbox && message_thread.sender.present?) end end diff --git a/app/models/fs/box.rb b/app/models/fs/box.rb index 96d1dcf48..dcbf94eac 100644 --- a/app/models/fs/box.rb +++ b/app/models/fs/box.rb @@ -41,7 +41,7 @@ def sync end def single_recipient? - false + true end store_accessor :settings, :dic, prefix: true diff --git a/app/models/upvs/box.rb b/app/models/upvs/box.rb index f396fc753..a905b70b7 100644 --- a/app/models/upvs/box.rb +++ b/app/models/upvs/box.rb @@ -47,7 +47,7 @@ def sync end def single_recipient? - true + false end private From 2ae51ba3c22c6629f747e75da705c550f2923c2b Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Mon, 30 Sep 2024 14:37:48 +0200 Subject: [PATCH 08/77] Migrate tags from MessageDraft to associated Message --- app/jobs/govbox/process_message_job.rb | 7 ----- app/jobs/govbox/submit_message_draft_job.rb | 2 +- app/models/govbox/message.rb | 29 +++++++++++++++++-- app/models/message_draft.rb | 15 ++++++++++ app/models/message_object.rb | 10 +++++++ app/models/tag.rb | 2 ++ ...40927104543_add_uuid_to_message_objects.rb | 5 ++++ db/schema.rb | 3 +- 8 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 db/migrate/20240927104543_add_uuid_to_message_objects.rb diff --git a/app/jobs/govbox/process_message_job.rb b/app/jobs/govbox/process_message_job.rb index 02ce40d19..65ac73700 100644 --- a/app/jobs/govbox/process_message_job.rb +++ b/app/jobs/govbox/process_message_job.rb @@ -10,8 +10,6 @@ def perform(govbox_message) processed_message = ::Message.where(type: [nil, 'Message']).where(uuid: govbox_message.message_id).joins(:thread).where(thread: { box_id: govbox_message.box.id }).take ActiveRecord::Base.transaction do - destroy_associated_message_draft(govbox_message) - message = Govbox::Message.create_message_with_thread!(govbox_message) mark_delivery_notification_authorized(govbox_message) @@ -24,11 +22,6 @@ def perform(govbox_message) private - def destroy_associated_message_draft(govbox_message) - message_draft = Upvs::MessageDraft.where(uuid: govbox_message.message_id).joins(:thread).where(thread: { box_id: govbox_message.box.id }).take - message_draft&.destroy - end - def mark_delivery_notification_authorized(govbox_message) return unless govbox_message.delivery_notification diff --git a/app/jobs/govbox/submit_message_draft_job.rb b/app/jobs/govbox/submit_message_draft_job.rb index 6615204da..d265b8417 100644 --- a/app/jobs/govbox/submit_message_draft_job.rb +++ b/app/jobs/govbox/submit_message_draft_job.rb @@ -51,7 +51,7 @@ def build_objects(message_draft) objects = [] message_draft.objects.each do |object| objects << { - id: SecureRandom.uuid, + id: object.uuid, name: object.name, encoding: "Base64", signed: object.is_signed, diff --git a/app/models/govbox/message.rb b/app/models/govbox/message.rb index fb48bb937..46835af51 100644 --- a/app/models/govbox/message.rb +++ b/app/models/govbox/message.rb @@ -27,6 +27,8 @@ class Govbox::Message < ApplicationRecord def self.create_message_with_thread!(govbox_message) message = nil + message_draft = Upvs::MessageDraft.where(uuid: govbox_message.message_id).joins(:thread).where(thread: { box_id: govbox_message.box.id }).take + tags_to_migrate = message_draft&.tags_to_migrate_to_message MessageThread.with_advisory_lock!(govbox_message.correlation_id, transaction: true, timeout_seconds: 10) do message = create_message(govbox_message) @@ -38,6 +40,7 @@ def self.create_message_with_thread!(govbox_message) delivered_at: govbox_message.delivered_at ) + message_draft&.destroy message.save! add_upvs_related_tags(message, govbox_message) @@ -45,6 +48,10 @@ def self.create_message_with_thread!(govbox_message) create_message_objects(message, govbox_message.payload) + migrate_tags_from_draft(message, tags_to_migrate) if tags_to_migrate + + MessageObject.mark_message_objects_externally_signed(message.objects) + EventBus.publish(:message_thread_created, message.thread) if message.thread.previously_new_record? EventBus.publish(:message_created, message) @@ -103,15 +110,14 @@ def self.create_message_objects(message, raw_message) raw_message["objects"].each do |raw_object| message_object_type = raw_object["class"] visualizable = (message_object_type == "FORM" && message.html_visualization.present?) ? true : nil - tags = raw_object["signed"] ? [message.thread.box.tenant.signed_externally_tag!] : [] message_object = message.objects.create!( + uuid: raw_object["id"], name: raw_object["name"], mimetype: raw_object["mime_type"], is_signed: raw_object["signed"], object_type: message_object_type, - visualizable: visualizable, - tags: tags + visualizable: visualizable ) if raw_object["encoding"] == "Base64" @@ -140,6 +146,23 @@ def self.add_upvs_related_tags(message, govbox_message) add_delivery_notification_tag(message) if message.can_be_authorized? end + def self.migrate_tags_from_draft(message, tags_to_migrate) + tags_to_migrate[:objects].each do |object_data| + object = message.objects.find_by(uuid: object_data[:uuid]) + object_data[:tags].each do |object_tag_id| + object.assign_tag(Tag.find(object_tag_id)) + end + end + + tags_to_migrate[:message].each do |message_tag_id| + message.tags.add_cascading_tag(Tag.find(message_tag_id)) + end + + tags_to_migrate[:thread].each do |thread_tag_id| + message.thread.assign_tag(Tag.find(thread_tag_id)) + end + end + def self.add_delivery_notification_tag(message) message.add_cascading_tag(delivery_notification_tag(message)) end diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 5dbd4839d..4346e8d3a 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -80,6 +80,21 @@ def submit raise NotImplementedError end + def tags_to_migrate_to_message + migration_list = {} + + migration_list[:objects] = objects.map do |object| + { + uuid: object.uuid, + tags: object.tags.signed.map(&:id) + } if object.tags.signed.any? + end.compact + migration_list[:message] = tags.simple.or(tags.signed).map(&:id) + migration_list[:thread] = (thread.tags.simple + thread.tags.signed).map(&:id) + + migration_list + end + def draft? true end diff --git a/app/models/message_object.rb b/app/models/message_object.rb index 08579fd15..33e763609 100644 --- a/app/models/message_object.rb +++ b/app/models/message_object.rb @@ -8,6 +8,7 @@ # name :string # object_type :string not null # to_be_signed :boolean default(FALSE), not null +# uuid :uuid # visualizable :boolean # created_at :datetime not null # updated_at :datetime not null @@ -57,6 +58,14 @@ def self.create_message_objects(message, objects) end end + def self.mark_message_objects_externally_signed(objects) + objects.find_each do |object| + next unless object.is_signed? + + object.assign_tag(object.message.tenant.signed_externally_tag!) unless object.tags.signed_internally.present? + end + end + def mark_signed_by_user(user) assign_tag(user.signed_by_tag) unassign_tag(user.signature_requested_from_tag) @@ -117,6 +126,7 @@ def assign_tag(tag) end def fill_missing_info + update(uuid: SecureRandom.uuid) unless uuid.present? update(name: name + Utils.file_extension_by_mimetype(mimetype).to_s) if Utils.file_name_without_extension?(self) update(mimetype: Utils.file_mimetype_by_name(entry_name: name)) if mimetype == Utils::OCTET_STREAM_MIMETYPE end diff --git a/app/models/tag.rb b/app/models/tag.rb index 3f28c1fc1..2b22d0e02 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -37,6 +37,8 @@ class Tag < ApplicationRecord scope :simple, -> { where(type: SimpleTag.to_s) } scope :visible, -> { where(visible: true) } scope :signing_tags, -> { where(type: ["SignedTag", "SignedByTag", "SignatureRequestedTag", "SignatureRequestedFromTag"]) } + scope :signed, -> { where(type: ["SignedTag", "SignedByTag", "SignedExternallyTag"]) } + scope :signed_internally, -> { where(type: ["SignedTag", "SignedByTag"]) } scope :archived, -> { where(type: ArchivedTag.to_s) } after_update_commit ->(tag) { EventBus.publish(:tag_renamed, tag) if previous_changes.key?("name") } diff --git a/db/migrate/20240927104543_add_uuid_to_message_objects.rb b/db/migrate/20240927104543_add_uuid_to_message_objects.rb new file mode 100644 index 000000000..a535f4a20 --- /dev/null +++ b/db/migrate/20240927104543_add_uuid_to_message_objects.rb @@ -0,0 +1,5 @@ +class AddUuidToMessageObjects < ActiveRecord::Migration[7.1] + def change + add_column :message_objects, :uuid, :uuid + end +end diff --git a/db/schema.rb b/db/schema.rb index b22c56b6d..5e01f3850 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_08_20_143244) do +ActiveRecord::Schema[7.1].define(version: 2024_09_27_104543) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -389,6 +389,7 @@ t.boolean "is_signed" t.boolean "to_be_signed", default: false, null: false t.boolean "visualizable" + t.uuid "uuid" t.index ["message_id"], name: "index_message_objects_on_message_id" end From a42bbd13af73e45e0de8b2742be29fb9643f8747 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 1 Oct 2024 12:59:57 +0200 Subject: [PATCH 09/77] Add test --- test/fixtures/govbox/messages.yml | 33 +++++++++++++++++++++++++ test/fixtures/message_objects.yml | 10 ++++++++ test/fixtures/message_objects_tags.yml | 4 +++ test/fixtures/message_threads_tags.yml | 12 +++++++++ test/fixtures/messages.yml | 4 +-- test/models/govbox/message_test.rb | 34 +++++++++++++++++++++----- 6 files changed, 89 insertions(+), 8 deletions(-) diff --git a/test/fixtures/govbox/messages.yml b/test/fixtures/govbox/messages.yml index ac834c646..2d66bde6c 100644 --- a/test/fixtures/govbox/messages.yml +++ b/test/fixtures/govbox/messages.yml @@ -139,6 +139,39 @@ ssd_referring_to_outbox_message: class: MyClass content: MyContent +ssd_general_created_from_draft: + message_id: 9b1b718a-c06c-487c-86c2-b68b8606aa5c + correlation_id: <%= SecureRandom.uuid %> + edesk_message_id: 7 + delivered_at: <%= DateTime.current %> + edesk_class: TEST + folder: ssd_sent + payload: + message_id: 9b1b718a-c06c-487c-86c2-b68b8606aa5c + subject: Title is not shown + sender_name: MySender + sender_uri: MySenderURIq + recipient_name: MyRecipient + delivered_at: <%= DateTime.current.to_s %> + original_html: Reply to something + objects: + - id: 6a0f716a-c284-4680-ad7e-ed2bde769dd2 + name: MyString + mime_type: MyString + class: FORM + content: MyContent + - id: af0e1c11-d226-45b7-8816-a5c24e139d35 + name: Attachment2 + mime_type: MyString + class: ATTACHMENT + content: MyContent + - id: 57c9954c-93e2-470c-833c-fd2bc6d8c70f + name: Attachment2 + mime_type: MyString + signed: true + class: ATTACHMENT + content: MyContent + ssd_without_recipient_name: message_id: <%= SecureRandom.uuid %> correlation_id: <%= SecureRandom.uuid %> diff --git a/test/fixtures/message_objects.yml b/test/fixtures/message_objects.yml index cbf70b78b..1fb8a96c2 100644 --- a/test/fixtures/message_objects.yml +++ b/test/fixtures/message_objects.yml @@ -50,17 +50,27 @@ ssd_main_fs_one_form: object_type: FORM ssd_main_draft_to_be_signed_draft_one_form: + uuid: 6a0f716a-c284-4680-ad7e-ed2bde769dd2 message: ssd_main_draft_to_be_signed_draft_one name: MyString mimetype: MyString object_type: FORM ssd_main_draft_to_be_signed_draft_one_attachment: + uuid: af0e1c11-d226-45b7-8816-a5c24e139d35 message: ssd_main_draft_to_be_signed_draft_one name: Attachment mimetype: MyString object_type: ATTACHMENT +ssd_main_draft_to_be_signed_draft_one_attachment2: + uuid: 57c9954c-93e2-470c-833c-fd2bc6d8c70f + message: ssd_main_draft_to_be_signed_draft_one + name: Attachment2 + mimetype: MyString + is_signed: true + object_type: ATTACHMENT + ssd_main_draft_to_be_signed_draft_two_form: message: ssd_main_draft_to_be_signed_draft_two name: MyString diff --git a/test/fixtures/message_objects_tags.yml b/test/fixtures/message_objects_tags.yml index 7def4cd62..c77cdc905 100644 --- a/test/fixtures/message_objects_tags.yml +++ b/test/fixtures/message_objects_tags.yml @@ -4,6 +4,10 @@ ssd_main_draft_to_be_signed_draft_one_form_signature_requested: message_object: ssd_main_draft_to_be_signed_draft_one_form tag: ssd_signer_user_signature_requested +ssd_main_draft_to_be_signed_draft_one_attachment2_signed_ssd_signer: + message_object: ssd_main_draft_to_be_signed_draft_one_attachment2 + tag: ssd_signer_user_signed + ssd_main_draft_to_be_signed_draft_two_form_signature_requested: message_object: ssd_main_draft_to_be_signed_draft_two_form tag: ssd_signer_user_signature_requested diff --git a/test/fixtures/message_threads_tags.yml b/test/fixtures/message_threads_tags.yml index 9fbd1ee40..97d5ebc2c 100644 --- a/test/fixtures/message_threads_tags.yml +++ b/test/fixtures/message_threads_tags.yml @@ -64,6 +64,18 @@ ssd_main_draft_to_be_signed_ssd_signer_user_signature_requested: message_thread: ssd_main_draft_to_be_signed tag: ssd_signer_user_signature_requested +ssd_main_draft_to_be_signed_ssd_signer_user_signed: + message_thread: ssd_main_draft_to_be_signed + tag: ssd_signer_user_signed + +ssd_main_draft_to_be_signed_ssd_signed: + message_thread: ssd_main_draft_to_be_signed + tag: ssd_signed + +ssd_main_draft_to_be_signed_ssd_submitted: + message_thread: ssd_main_draft_to_be_signed + tag: ssd_submitted + ssd_main_draft_to_be_signed2_finance: message_thread: ssd_main_draft_to_be_signed2 tag: ssd_finance diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml index b5f2b3df5..4a85b9322 100644 --- a/test/fixtures/messages.yml +++ b/test/fixtures/messages.yml @@ -186,8 +186,8 @@ ssd_main_collapsed_two: collapsed: true ssd_main_draft_to_be_signed_draft_one: - type: MessageDraft - uuid: <%= SecureRandom.uuid %> + type: Upvs::MessageDraft + uuid: 9b1b718a-c06c-487c-86c2-b68b8606aa5c title: Title is not shown html_visualization: Reply to something delivered_at: 2023-05-18 16:18:26 diff --git a/test/models/govbox/message_test.rb b/test/models/govbox/message_test.rb index 69a5eea08..c5e5f6421 100644 --- a/test/models/govbox/message_test.rb +++ b/test/models/govbox/message_test.rb @@ -1,7 +1,7 @@ require "test_helper" class Govbox::MessageTest < ActiveSupport::TestCase - test "should create message, its objects and not visible tag" do + test "#create_message_with_thread! should create message, its objects and not visible tag" do govbox_message = govbox_messages(:one) Govbox::Message.create_message_with_thread!(govbox_message) @@ -29,7 +29,29 @@ class Govbox::MessageTest < ActiveSupport::TestCase assert_equal message.tags.first, message.thread.tags.simple.first end - test "should take name from box as recipient_name if no recipient_name in govbox message" do + test "#create_message_with_thread! migrates tags from associated MessageDraft" do + message_draft = messages(:ssd_main_draft_to_be_signed_draft_one) + govbox_message = govbox_messages(:ssd_general_created_from_draft) + + Govbox::Message.create_message_with_thread!(govbox_message) + + message = Message.last + + # Simple and Signed tags copied to MessageThread + assert message.thread.tags.visible.simple.map(&:name).difference(message_draft.thread.tags.visible.simple.map(&:name)).none? + assert message.thread.tags.signed.map(&:name).all? { |tag_name| message.thread.tags.signed.map(&:name).include?(tag_name) } + + # No SignatureRequested, Submiited tags copied to MessageThread + assert message.thread.tags.where(type: ['SignatureRequestedTag', 'SignatureRequestedFromTag', 'Submitted']).none? + + # Signed tags copied to MessageObjects + assert message.objects.first.tags.signed.map(&:name).all? { |tag_name| message.objects.first.tags.signed.map(&:name).include?(tag_name) } + + # No SignatureRequested tags copied to MessageObjects + assert message.form_object.tags.where(type: ['SignatureRequestedTag', 'SignatureRequestedFromTag']).none? + end + + test "#create_message_with_thread! should take name from box as recipient_name if no recipient_name in govbox message" do govbox_message = govbox_messages(:ssd_without_recipient_name) Govbox::Message.create_message_with_thread!(govbox_message) @@ -41,7 +63,7 @@ class Govbox::MessageTest < ActiveSupport::TestCase assert_equal message.recipient_name, "SSD main" end - test "should include general agenda subject in message title" do + test "#create_message_with_thread! should include general agenda subject in message title" do govbox_message = govbox_messages(:ssd_general_agenda) Govbox::Message.create_message_with_thread!(govbox_message) @@ -51,7 +73,7 @@ class Govbox::MessageTest < ActiveSupport::TestCase assert_equal message.title, "Všeobecná Agenda - Rozhodnutie ..." end - test "should not create new tag if already exists" do + test "#create_message_with_thread! should not create new tag if already exists" do govbox_message = govbox_messages(:one) tag = SimpleTag.create!(external_name: "slovensko.sk:#{govbox_message.folder.name}", name: "slovensko.sk:#{govbox_message.folder.name}", tenant: govbox_message.folder.box.tenant, visible: false) @@ -66,7 +88,7 @@ class Govbox::MessageTest < ActiveSupport::TestCase assert_equal tag, message.thread.tags.simple.first end - test "should not duplicate message thread tags" do + test "#create_message_with_thread! should not duplicate message thread tags" do govbox_message1 = govbox_messages(:one) govbox_message2 = govbox_messages(:three) @@ -88,7 +110,7 @@ class Govbox::MessageTest < ActiveSupport::TestCase assert_equal tag, message2.thread.tags.simple.first end - test "should not use delivery notification title for message thread title" do + test "#create_message_with_thread! should not use delivery notification title for message thread title" do govbox_message = govbox_messages(:solver_delivery_notification) Govbox::Message.create_message_with_thread!(govbox_message) From db253a76492a7b5b06128916419d055b1a06d757 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 1 Oct 2024 13:15:49 +0200 Subject: [PATCH 10/77] Small changes --- app/models/govbox/message.rb | 2 +- app/models/message_draft.rb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/models/govbox/message.rb b/app/models/govbox/message.rb index 46835af51..4f78bd5ee 100644 --- a/app/models/govbox/message.rb +++ b/app/models/govbox/message.rb @@ -150,7 +150,7 @@ def self.migrate_tags_from_draft(message, tags_to_migrate) tags_to_migrate[:objects].each do |object_data| object = message.objects.find_by(uuid: object_data[:uuid]) object_data[:tags].each do |object_tag_id| - object.assign_tag(Tag.find(object_tag_id)) + object&.assign_tag(Tag.find(object_tag_id)) end end diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 4346e8d3a..15bb90c47 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -83,11 +83,10 @@ def submit def tags_to_migrate_to_message migration_list = {} - migration_list[:objects] = objects.map do |object| - { - uuid: object.uuid, - tags: object.tags.signed.map(&:id) - } if object.tags.signed.any? + migration_list[:objects] = objects.map do |object| { + uuid: object.uuid, + tags: object.tags.signed.map(&:id) + } if object.tags.signed.any? end.compact migration_list[:message] = tags.simple.or(tags.signed).map(&:id) migration_list[:thread] = (thread.tags.simple + thread.tags.signed).map(&:id) From 6195bb1b175f7566898bc5185291e4ba4cd3a976 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 1 Oct 2024 17:29:11 +0200 Subject: [PATCH 11/77] Add drag&drop zone to upload FS drafts --- app/components/common/icon_component.rb | 1 + .../fs_message_drafts_controller.js | 51 +++++++++++++++++++ app/javascript/controllers/index.js | 3 ++ .../fs/message_drafts/_new_form.html.erb | 23 +++++++-- 4 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 app/javascript/controllers/fs_message_drafts_controller.js diff --git a/app/components/common/icon_component.rb b/app/components/common/icon_component.rb index e2dab9504..a4d509ca3 100644 --- a/app/components/common/icon_component.rb +++ b/app/components/common/icon_component.rb @@ -25,6 +25,7 @@ class IconComponent < ViewComponent::Base "cloud-arrow-down" => "M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z", "paper-airplane" => "M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5", "document-arrow-down" => "M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m.75 12 3 3m0 0 3-3m-3 3v-6m-1.5-9H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z", + "document-text" => "M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z", "folder-arrow-down" => "m9 13.5 3 3m0 0 3-3m-3 3v-6m1.06-4.19-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z" }.freeze diff --git a/app/javascript/controllers/fs_message_drafts_controller.js b/app/javascript/controllers/fs_message_drafts_controller.js new file mode 100644 index 000000000..8255a479c --- /dev/null +++ b/app/javascript/controllers/fs_message_drafts_controller.js @@ -0,0 +1,51 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + connect() { + const dropzone = document.getElementById('dropzone'); + const fileInput = document.getElementById('content[]'); + const fileList = document.getElementById('fileList'); + + dropzone.addEventListener('dragover', (e) => { + e.preventDefault(); + dropzone.classList.add('border-blue-500', 'border-2'); + }); + + dropzone.addEventListener('dragleave', () => { + dropzone.classList.remove('border-blue-500', 'border-2'); + }); + + dropzone.addEventListener('drop', (e) => { + e.preventDefault(); + dropzone.classList.remove('border-blue-500', 'border-2'); + + const files = e.dataTransfer.files; + this.handleFiles(files); + }); + + fileInput.addEventListener('change', (e) => { + const files = e.target.files; + this.handleFiles(files); + }); + } + + handleFiles(files) { + fileList.innerHTML = ''; + + for (const file of files) { + const listItem = document.createElement('div'); + listItem.textContent = `${file.name} (${this.formatBytes(file.size)})`; + fileList.appendChild(listItem); + } + } + + formatBytes(bytes) { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; + } +} diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js index ab062b49a..1fdb9a24a 100644 --- a/app/javascript/controllers/index.js +++ b/app/javascript/controllers/index.js @@ -28,6 +28,9 @@ application.register("form", FormController) import MessageDraftsController from "./message_drafts_controller" application.register("message-drafts", MessageDraftsController) +import FsMessageDraftsController from "./fs_message_drafts_controller" +application.register("fs-message-drafts", FsMessageDraftsController) + import TriStateCheckboxController from "./tri_state_checkbox_controller" application.register("tri-state-checkbox", TriStateCheckboxController) diff --git a/app/views/fs/message_drafts/_new_form.html.erb b/app/views/fs/message_drafts/_new_form.html.erb index 4c14ca739..6a92549a4 100644 --- a/app/views/fs/message_drafts/_new_form.html.erb +++ b/app/views/fs/message_drafts/_new_form.html.erb @@ -1,9 +1,24 @@ <%= form_with url: fs_message_drafts_path, id: form_id, multipart: true, class: 'w-full' do |f| %>
-
- - <%= file_field_tag 'content[]', multiple: true %> +
+ +
+ <%= content_tag(:div, { + "data-controller": "fs-message-drafts", + class: "text-center mt-6" + }) do %> + <%= render Common::IconComponent.new("document-text", classes: "mx-auto h-12 w-12 text-gray-300") %> +
+ +

alebo ich sem presuňte

+
+
+ <% end %> +
@@ -19,4 +34,4 @@ Nahrať správy <% end %> -
\ No newline at end of file +
From 4f48540ea652a39bc45c4fa3a7bf882a66634121 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 2 Oct 2024 11:42:11 +0200 Subject: [PATCH 12/77] Save templates MessageDraft content to HTML visualization in order to be searchable --- app/helpers/message_helper.rb | 4 ++ app/models/message_draft.rb | 1 + test/fixtures/message_object_data.yml | 4 ++ test/fixtures/message_objects.yml | 6 +++ test/fixtures/message_threads.yml | 7 ++++ test/fixtures/message_threads_tags.yml | 4 ++ test/fixtures/messages.yml | 14 +++++++ test/fixtures/tag_groups.yml | 4 ++ test/fixtures/tags.yml | 2 +- test/fixtures/upvs/message_templates.yml | 1 + test/system/message_drafts_test.rb | 53 ++++++++++++++++++++++++ 11 files changed, 99 insertions(+), 1 deletion(-) diff --git a/app/helpers/message_helper.rb b/app/helpers/message_helper.rb index 22e028694..ecd440771 100644 --- a/app/helpers/message_helper.rb +++ b/app/helpers/message_helper.rb @@ -6,6 +6,10 @@ def self.export_filename(message) def format_html_visualization return ActionController::Base.helpers.simple_format(html_visualization) if is_a?(Fs::MessageDraft) + return metadata["data"].map do |k,v| + "#{k}: #{v}" + end.join(', ') if template.present? + html_visualization end end diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 5dbd4839d..2dc4c11a9 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -70,6 +70,7 @@ class MessageDraft < Message def update_content(parameters) metadata["data"] = parameters.to_h + self.html_visualization = format_html_visualization save! template.build_message_from_template(self) diff --git a/test/fixtures/message_object_data.yml b/test/fixtures/message_object_data.yml index 3df899c3f..b01660fca 100644 --- a/test/fixtures/message_object_data.yml +++ b/test/fixtures/message_object_data.yml @@ -12,6 +12,10 @@ draft_two: message_object: ssd_main_general_draft_two_form blob: predmettext +empty_draft: + message_object: ssd_main_empty_draft_form + blob: + fs_one: message_object: ssd_main_fs_one_form blob: Daňový úrad Bratislava Ševčenkova 32, 850 00 Bratislava 000000000/2022 Mgr. X Y 02/00000000 x.y@FINANCNASPRAVA.SK Bratislava 2022-04-19 Rozhodnutie diff --git a/test/fixtures/message_objects.yml b/test/fixtures/message_objects.yml index cbf70b78b..4358c11f6 100644 --- a/test/fixtures/message_objects.yml +++ b/test/fixtures/message_objects.yml @@ -108,3 +108,9 @@ ssd_main_draft_to_be_signed4_draft_form: name: MyString mimetype: MyString object_type: FORM + +ssd_main_empty_draft_form: + message: ssd_main_empty_draft + name: MyString + mimetype: MyString + object_type: FORM diff --git a/test/fixtures/message_threads.yml b/test/fixtures/message_threads.yml index a4ca141fb..4cc60e30a 100644 --- a/test/fixtures/message_threads.yml +++ b/test/fixtures/message_threads.yml @@ -63,6 +63,13 @@ ssd_main_draft_to_be_signed4: delivered_at: 2023-05-18 18:15:22 last_message_delivered_at: 2023-05-18 18:16:22 +ssd_main_empty_draft: + box: ssd_main + title: Empty Draft + original_title: MyString + delivered_at: 2023-05-18 16:05:00 + last_message_delivered_at: 2023-05-18 16:05:00 + solver_main_general_agenda: box: solver_main title: General agenda Solver diff --git a/test/fixtures/message_threads_tags.yml b/test/fixtures/message_threads_tags.yml index 9fbd1ee40..2110dbcc1 100644 --- a/test/fixtures/message_threads_tags.yml +++ b/test/fixtures/message_threads_tags.yml @@ -127,3 +127,7 @@ ssd_main_draft_to_be_signed4_ssd_signature_requested: ssd_main_draft_to_be_signed4_ssd_signers_signature_requested: message_thread: ssd_main_draft_to_be_signed4 tag: ssd_signers_signature_requested + +ssd_main_empty_draft_ssd_basic_user_drafts: + message_thread: ssd_main_empty_draft + tag: ssd_basic_user_drafts diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml index b5f2b3df5..1c2dce92d 100644 --- a/test/fixtures/messages.yml +++ b/test/fixtures/messages.yml @@ -263,6 +263,20 @@ ssd_main_draft_to_be_signed4_draft: status: created author: basic +ssd_main_empty_draft: + type: Upvs::MessageDraft + uuid: <%= SecureRandom.uuid %> + title: Všeobecná agenda + delivered_at: 2023-05-18 16:05:00 + thread: ssd_main_empty_draft + replyable: false + metadata: + status: created + template_id: 2 + recipient_uri: ico://sk/83369723 + correlation_id: <%= SecureRandom.uuid %> + author: basic + solver_main_delivery_notification_one: uuid: bbff2617-3430-44c6-b827-519059ff1e90 title: Authorized Delivery notification diff --git a/test/fixtures/tag_groups.yml b/test/fixtures/tag_groups.yml index 2b00667b4..856268e80 100644 --- a/test/fixtures/tag_groups.yml +++ b/test/fixtures/tag_groups.yml @@ -1,5 +1,9 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +drafts_basic_user: + tag: ssd_basic_user_drafts + group: ssd_basic_user + finance_basic_user: tag: ssd_finance group: ssd_basic_user diff --git a/test/fixtures/tags.yml b/test/fixtures/tags.yml index 87330fdab..b8c4d4775 100644 --- a/test/fixtures/tags.yml +++ b/test/fixtures/tags.yml @@ -175,7 +175,7 @@ solver_everything: visible: false tenant: solver -solver_basic_user_drafts: +ssd_basic_user_drafts: name: Drafts-Basic user owner: basic type: DraftTag diff --git a/test/fixtures/upvs/message_templates.yml b/test/fixtures/upvs/message_templates.yml index 45a846bda..dbea37d6b 100644 --- a/test/fixtures/upvs/message_templates.yml +++ b/test/fixtures/upvs/message_templates.yml @@ -14,6 +14,7 @@ message_reply: type: Upvs::MessageTemplate general_agenda: + id: 2 content: {{ Predmet:text_field }} {{ Text:text_area }} diff --git a/test/system/message_drafts_test.rb b/test/system/message_drafts_test.rb index f31c31120..c29b01a07 100644 --- a/test/system/message_drafts_test.rb +++ b/test/system/message_drafts_test.rb @@ -1,6 +1,59 @@ require "application_system_test_case" class MessageDraftsTest < ApplicationSystemTestCase + setup do + Searchable::MessageThread.reindex_all + + silence_warnings do + @old_value = MessageThreadCollection.const_get("PER_PAGE") + MessageThreadCollection.const_set("PER_PAGE", 1) + end + + sign_in_as(:basic) + end + + teardown do + silence_warnings do + MessageThreadCollection.const_set("PER_PAGE", @old_value) + end + end + test "user can create message draft as reply on replyable message" do end + + test "templated message draft content is searchable" do + message = messages(:ssd_main_empty_draft) + thread = message_threads(:ssd_main_empty_draft) + + visit message_thread_path thread + + within "#body_upvs_message_draft_#{message.id}_form" do + fill_in "message_draft_Text", with: "Pozdrav zo Slovensko.Digital! :)" + fill_in "message_draft_Predmet", with: "Pozdravovacia sprava" + end + + assert_text "Zmeny boli uložené" + + GoodJob.perform_inline + + # Search the draft content keywords + visit message_threads_path + + assert_no_selector "#next_page_area" + + fill_in "search", with: "Slovensko.Digital" + find("#search").send_keys(:enter) + + assert_no_selector "#next_page_area" + + thread_general = message_threads(:ssd_main_general) + thread_issue = message_threads(:ssd_main_issue) + + within_thread_in_listing(thread) do + assert_text "Slovensko.Digital" + end + + refute_selector(thread_in_listing_selector(thread_general)) + refute_selector(thread_in_listing_selector(thread_issue)) + end end From a07f79067f20b2b3b6944370d1e81f223a1c1fff Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Fri, 4 Oct 2024 23:43:14 +0200 Subject: [PATCH 13/77] Add labels to creating new tag --- app/components/admin/tags/tag_form_component.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/admin/tags/tag_form_component.html.erb b/app/components/admin/tags/tag_form_component.html.erb index b0761ddd1..bb80f335b 100644 --- a/app/components/admin/tags/tag_form_component.html.erb +++ b/app/components/admin/tags/tag_form_component.html.erb @@ -6,7 +6,6 @@

<%= @tag.new_record? ? "Nový štítok" : "Úprava štítku" %>

-

Názov štítku

<%= render Common::CloseButtonComponent.new(link_to: admin_tenant_tags_path(Current.tenant)) %>
@@ -14,16 +13,19 @@
- <%= form.text_field :name, placeholder: "Názov štítku", class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %> + <%= form.label :name, "Názov štítku" %> + <%= form.text_field :name, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
+ <%= form.label :color, "Farba" %> <%= form.select :color, helpers.color_select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
+ <%= form.label :icon, "Ikonka" %> <%= form.select :icon, helpers.icon_select_options, {}, class: "block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %>
From e4e5e168c2b0d0ec75008dcaa97f9a16bc1f30bf Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Fri, 11 Oct 2024 18:50:15 +0200 Subject: [PATCH 14/77] Strip subject parsed from FS API --- app/models/fs/message_draft.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/fs/message_draft.rb b/app/models/fs/message_draft.rb index df66f84a7..18b9d9abf 100644 --- a/app/models/fs/message_draft.rb +++ b/app/models/fs/message_draft.rb @@ -32,7 +32,7 @@ def self.create_and_validate_with_fs_form(form_files: [], author:, fs_client: Fs form_files.each do |form_file| form_content = form_file.read.force_encoding("UTF-8") form_information = fs_client.api.parse_form(form_content) - dic = form_information['subject'] + dic = form_information['subject']&.strip fs_form_identifier = form_information['form_identifier'] box = Fs::Box.with_enabled_message_drafts_import.find_by("settings ->> 'dic' = ?", dic) From 554a956a8b9e3e36d71f3c4f53708560e7d492f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Sun, 13 Oct 2024 19:05:27 +0200 Subject: [PATCH 15/77] fix: logout on callback error --- config/initializers/omniauth.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index c0c9e6817..6c110fd11 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -8,6 +8,10 @@ # Respond to saml, saml/callback, saml/metadata, saml/slo, and saml/spslo under path prefix. config.path_prefix = '/auth' + config.on_failure do |env| + SessionsController.action(:destroy).call(env) + end + # Use default application logger. config.logger = Rails.logger end From bb0a0a04b5c8684ca004f31d977dbb73d9bb499c Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 15 Oct 2024 12:23:52 +0200 Subject: [PATCH 16/77] Draft downloading sent FS message --- app/components/message_component.html.erb | 2 +- app/jobs/fs/download_sent_message_job.rb | 83 +++++++++++++++++++ .../fs/submit_message_draft_result_job.rb | 1 + app/lib/utils.rb | 5 +- app/models/message.rb | 2 +- 5 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 app/jobs/fs/download_sent_message_job.rb diff --git a/app/components/message_component.html.erb b/app/components/message_component.html.erb index e1d1b64b8..ab7e7a8da 100644 --- a/app/components/message_component.html.erb +++ b/app/components/message_component.html.erb @@ -44,7 +44,7 @@ <%= render Upvs::DeliveryNotificationFictionMessageBodyComponent.new(message: @message) %> <% elsif @message.html_visualization %>