Skip to content

Commit

Permalink
Small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
luciajanikova committed Oct 25, 2024
1 parent fc21ac5 commit c60bd4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/components/message_state_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<% if @message.form_object&.is_signed? || @message.form_object.present? || @message.authorized? %>
<div class="w-fit flex flex-col gap-1 <%= @classes %>">
<% if @message.form_object&.is_signed? %>
<div class="w-fit flex flex-row gap-1 <%= @classes %>">
<% 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 %>
Expand Down
2 changes: 1 addition & 1 deletion app/models/govbox/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down

0 comments on commit c60bd4e

Please sign in to comment.