-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into GO-75/jobs_priority
# Conflicts: # test/fixtures/message_object_data.yml # test/fixtures/message_objects.yml # test/system/message_drafts_test.rb
- Loading branch information
Showing
95 changed files
with
4,973 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Fs::MessageHelper | ||
def self.build_html_visualization(message) | ||
return [ActionController::Base.new.render_to_string('fs/messages/_submission', layout: false, locals: { message: message }), build_html_visualization_from_form(message)].compact.join('<hr>') if message.outbox? | ||
|
||
# TODO: Vieme aj lepsie identifikovat? Nejake dalsie typy v tejto kategorii neexistuju? | ||
template = if message.title.in?(['Informácia o podaní', 'Informácia o odmietnutí podania']) | ||
'fs/messages/_delivery_report' | ||
else | ||
'fs/messages/_generic_message' | ||
end | ||
|
||
ActionController::Base.new.render_to_string(template, layout: false, locals: { message: message }) | ||
end | ||
|
||
def self.build_html_visualization_from_form(message) | ||
raise 'Missing Fs::Form XSLT' unless message.form&.xslt_txt | ||
return unless message.form_object&.unsigned_content | ||
|
||
template = Nokogiri::XSLT(message.form.xslt_txt) | ||
|
||
ActionController::Base.new.render_to_string('fs/messages/_style', layout: false, locals: { message: message }) + ActionController::Base.helpers.simple_format(template.transform(message.form_object.xml_unsigned_content).to_s) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module MessageThreadHelper | ||
def self.show_recipient?(message_thread) | ||
!message_thread.box.single_recipient? && message_thread.is_outbox && message_thread.recipient.present? | ||
end | ||
|
||
def self.show_sender?(message_thread) | ||
message_thread.box.single_recipient? || (!message_thread.is_outbox && message_thread.sender.present?) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Controller } from "@hotwired/stimulus" | ||
|
||
export default class extends Controller { | ||
connect() { | ||
const dropzone = document.getElementById('dropzone'); | ||
const fileInput = document.getElementById('content[]'); | ||
const fileList = document.getElementById('fileList'); | ||
|
||
dropzone.addEventListener('dragover', (e) => { | ||
e.preventDefault(); | ||
dropzone.classList.add('border-blue-500', 'border-2'); | ||
}); | ||
|
||
dropzone.addEventListener('dragleave', () => { | ||
dropzone.classList.remove('border-blue-500', 'border-2'); | ||
}); | ||
|
||
dropzone.addEventListener('drop', (e) => { | ||
e.preventDefault(); | ||
dropzone.classList.remove('border-blue-500', 'border-2'); | ||
|
||
const files = e.dataTransfer.files; | ||
this.handleFiles(files); | ||
}); | ||
|
||
fileInput.addEventListener('change', (e) => { | ||
const files = e.target.files; | ||
this.handleFiles(files); | ||
}); | ||
} | ||
|
||
handleFiles(files) { | ||
const fileInput = document.getElementById('content[]'); | ||
fileInput.files = files; | ||
|
||
for (const file of files) { | ||
const listItem = document.createElement('div'); | ||
listItem.textContent = `${file.name} (${this.formatBytes(file.size)})`; | ||
fileList.appendChild(listItem); | ||
} | ||
} | ||
|
||
formatBytes(bytes) { | ||
if (bytes === 0) return '0 Bytes'; | ||
|
||
const k = 1024; | ||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | ||
const i = Math.floor(Math.log(bytes) / Math.log(k)); | ||
|
||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Fs | ||
class DownloadReceivedMessageJob < ApplicationJob | ||
def perform(fs_message_id, box:, fs_client: FsEnvironment.fs_client) | ||
raise unless box.is_a?(Fs::Box) | ||
return unless box.syncable? | ||
|
||
return if box.messages.where("metadata ->> 'fs_message_id' = ?", fs_message_id).any? | ||
|
||
ActiveRecord::Base.transaction do | ||
fs_api = fs_client.api(api_connection: box.api_connection, box: box) | ||
|
||
raw_message = fs_api.fetch_received_message(fs_message_id) | ||
|
||
Fs::Message.create_inbox_message_with_thread!(raw_message, box: box) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.