diff --git a/app/components/message_state_component.html.erb b/app/components/message_state_component.html.erb
index b142f248..a32db3dd 100644
--- a/app/components/message_state_component.html.erb
+++ b/app/components/message_state_component.html.erb
@@ -1,11 +1,17 @@
<% if @message.form_object&.is_signed? || @message.form_object.present? || @message.authorized? %>
-
- <% if @message.form_object&.is_signed? %>
+
+ <% if @message.form_object.tags.signed_by.any? %>
+ <% @message.form_object.tags.signed_by.each do |tag| %>
+ <%= render Common::BadgeComponent.new(tag.name, "green", "fingerprint") %>
+ <% end %>
+ <% elsif @message.form_object&.is_signed? %>
<%= render Common::BadgeComponent.new("Podpísané", "green", "fingerprint") %>
<% end %>
+
<% if @message.authorized? %>
<%= render Common::BadgeComponent.new("Prevzatá doručenka", "purple") %>
<% end %>
+
<% if @message.thread.archived? %>
<%= render ArchivedObjectTagComponent.new(@message.form_object&.archived_object) %>
<% end %>
diff --git a/app/models/govbox/message.rb b/app/models/govbox/message.rb
index b8f73ce2..fa6985e3 100644
--- a/app/models/govbox/message.rb
+++ b/app/models/govbox/message.rb
@@ -32,7 +32,7 @@ def self.create_message_with_thread!(govbox_message)
MessageThread.with_advisory_lock!(govbox_message.correlation_id, transaction: true, timeout_seconds: 10) do
message = create_message(govbox_message)
- message.thread = message_draft.thread if message_draft || govbox_message.box.message_threads.find_or_create_by_merge_uuid!(
+ message.thread = (message_draft.thread if message_draft) || govbox_message.box.message_threads.find_or_create_by_merge_uuid!(
box: govbox_message.box,
merge_uuid: govbox_message.correlation_id,
title: message.metadata.dig("delivery_notification", "consignment", "subject").presence || message.title,
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 2b22d0e0..9df1e434 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -38,6 +38,7 @@ class Tag < ApplicationRecord
scope :visible, -> { where(visible: true) }
scope :signing_tags, -> { where(type: ["SignedTag", "SignedByTag", "SignatureRequestedTag", "SignatureRequestedFromTag"]) }
scope :signed, -> { where(type: ["SignedTag", "SignedByTag", "SignedExternallyTag"]) }
+ scope :signed_by, -> { where(type: "SignedByTag") }
scope :signed_internally, -> { where(type: ["SignedTag", "SignedByTag"]) }
scope :archived, -> { where(type: ArchivedTag.to_s) }