Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GO-49 Do not submit message unless requested signatures present #484

Merged

Conversation

luciajanikova
Copy link
Member

@luciajanikova luciajanikova commented Oct 28, 2024

Nahradza: #454

@luciajanikova luciajanikova requested a review from jsuchal October 28, 2024 09:38
@@ -167,6 +167,10 @@ def unassign_tag(tag)
message_threads_tags.find_by(tag: tag)&.destroy
end

def any_objects_with_requested_signature?
messages.any? { |message| message.any_objects_with_requested_signature? }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nie je toto tak, ze ked tam je requested tag tak potom ked to podpises tak uz tam taky tag nebude? Cize staci zistit, ze tam nejaky takyto tag je nie?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je, vieme to tak ulahcit

@luciajanikova luciajanikova requested a review from jsuchal October 28, 2024 12:52
Comment on lines 100 to 101
objects.any? { |message_object| message_object.tags.where(type: SignatureRequestedFromTag.to_s).any? }
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto mozno by sa dalo aj jednym exists selectom z opacnej strany nie?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upravila som, pozri prosim.

@@ -41,6 +43,10 @@ def destroy
def message_thread_policy_scope
policy_scope(MessageThread)
end

def any_missing_signature?(message_threads)
message_threads.any? { |thread| thread.any_objects_with_requested_signature? }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resp nevieme sa tu rovno spytat, ze "existuje nejaky requesting tag na objekte v tychto vlaknach"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upravila som, pozri prosim.

@luciajanikova luciajanikova requested a review from jsuchal October 28, 2024 16:09
end

def not_submittable_errors
return [] if submittable?

errors = []
errors << 'Vyplňte obsah správy' unless form_object.content.present?
errors << 'Pred odoslaním podpíšte všetky dokumenty na podpis' unless objects.to_be_signed.all? { |o| o.is_signed? }
errors << 'Pred odoslaním podpíšte všetky dokumenty na podpis' if (objects.to_be_signed.any? { |o| !o.is_signed? } || any_objects_with_requested_signature?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nie je toto nejaka duplicita? Preco sa pytame ci je podpisany a potom este raz ci tam nie je nejaky objekt co ma byt podpisany?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ano, je to do urcitej miery duplicita, lebo v casti UPVS importov sme zvyknuti na oznacenie cez atribut to_be_signed a inak cez tagy. Mali by sme to zjednotit, tento atribut to_be_signed si myslim, ze nepotrebujeme.
Uz mame na to lepsie riesenie (vtedy este uplne nebolo). Skusim upratat.

@@ -37,6 +37,7 @@ 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 :signature_requesting, -> { where(type: ["SignatureRequestedTag", "SignatureRequestedFromTag"]) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nestaci sa pytat na ten prvy?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staci na druhy (prvy byva iba na threade, druhy byva na threade & na message objecte rovnako), upravila som

…_signatures

# Conflicts:
#	app/models/message_object.rb
#	app/models/tag.rb
#	db/schema.rb
@luciajanikova luciajanikova merged commit 5562e60 into main Oct 29, 2024
3 checks passed
@luciajanikova luciajanikova deleted the GO-49/do_not_submit_drafts_without_requested_signatures branch October 29, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants