-
Notifications
You must be signed in to change notification settings - Fork 6
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
GO-49 Do not submit message unless requested signatures present #484
Conversation
app/models/message_thread.rb
Outdated
@@ -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? } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
app/models/message.rb
Outdated
objects.any? { |message_object| message_object.tags.where(type: SignatureRequestedFromTag.to_s).any? } | ||
end |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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? } |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upravila som, pozri prosim.
app/models/message_draft.rb
Outdated
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?) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
app/models/tag.rb
Outdated
@@ -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"]) } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Nahradza: #454