Skip to content

Commit

Permalink
Merge pull request #487 from slovensko-digital/GO-141/do_not_inform_u…
Browse files Browse the repository at this point in the history
…ser_about_diff

GO-141 Do not inform user about message_draft diff in validations
  • Loading branch information
luciajanikova authored Nov 14, 2024
2 parents 8a5e659 + 5868114 commit 8a99e68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/jobs/fs/validate_message_draft_result_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ def perform(message_draft, location_header, fs_client: FsEnvironment.fs_client)
message_draft.metadata[:validation_errors] = {
result: response[:body]['result'],
errors: response[:body]['problems']&.select { |problem| problem['level'] == 'error' }&.map{ |problem| problem['message'] },
warnings: response[:body]['problems']&.select { |problem| problem['level'] == 'warning' }&.map{ |problem| problem['message'] }
warnings: response[:body]['problems']&.select { |problem| problem['level'] == 'warning' }&.map{ |problem| problem['message'] },
}
message_draft.add_cascading_tag(message_draft.tenant.submission_error_tag)

diff = response[:body]['problems']&.select { |problem| problem['level'] == 'diff' }
Rails.logger.info("Message draft DIFF: #{diff.map{ |problem| problem['message']}.join(', ')}") if diff.any?

message_draft.add_cascading_tag(message_draft.tenant.submission_error_tag) if message_draft.metadata[:validation_errors][:errors].any? || message_draft.metadata[:validation_errors][:warnings].any?
end

message_draft.save
Expand Down

0 comments on commit 8a99e68

Please sign in to comment.