-
-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] mail_drop_target: Migration to 15.0
- Loading branch information
1 parent
ea01a04
commit d31eceb
Showing
8 changed files
with
113 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** @odoo-module **/ | ||
/* global base64js:false, Uint8Array:false */ | ||
// Copyright 2018 Therp BV <https://therp.nl> | ||
// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
import {MessageList} from "@mail/components/message_list/message_list"; | ||
import {patch} from "web.utils"; | ||
import {useDragVisibleDropZone} from "@mail/component_hooks/use_drag_visible_dropzone/use_drag_visible_dropzone"; | ||
|
||
patch(MessageList.prototype, "mail_drop_target.mail_drop", { | ||
setup() { | ||
this._super(); | ||
this.isDropZoneVisible = useDragVisibleDropZone(); | ||
}, | ||
async _onDropZoneFilesDropped(ev) { | ||
ev.stopPropagation(); | ||
this.isDropZoneVisible.value = false; | ||
var self = this; | ||
Promise.all( | ||
Array.from(ev.detail.files).map((drop_file) => { | ||
var reader = new FileReader(); | ||
var mail_processor = ""; | ||
if (drop_file.name.endsWith(".msg")) { | ||
mail_processor = "message_process_msg"; | ||
} else { | ||
mail_processor = "message_drop"; | ||
} | ||
reader.readAsArrayBuffer(drop_file); | ||
reader.onload = function (event) { | ||
var data = ""; | ||
// TODO: read some config parameter if this should set | ||
// some of the context keys to suppress mail.thread's behavior | ||
if (mail_processor == "message_process_msg") { | ||
data = base64js.fromByteArray( | ||
new Uint8Array(event.target.result) | ||
); | ||
} else { | ||
var reader_array = new Uint8Array(event.target.result); | ||
data = ""; | ||
for (var i = 0; i < reader_array.length; i++) { | ||
data += String.fromCharCode(parseInt(reader_array[i])); | ||
} | ||
} | ||
self.env.services.rpc({ | ||
model: "mail.thread", | ||
method: mail_processor, | ||
args: [self.threadView.thread.model, data], | ||
kwargs: { | ||
thread_id: self.threadView.thread.id, | ||
}, | ||
}); | ||
}; | ||
}) | ||
).then(function () { | ||
return self.trigger("reload"); | ||
}); | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<templates id="template" xml:space="preserve"> | ||
|
||
<t t-inherit="mail.MessageList" t-inherit-mode="extension"> | ||
<xpath expr="//div[1]" position="inside"> | ||
<t t-if="isDropZoneVisible.value"> | ||
<DropZone | ||
class="o_MailBox_dropZone" | ||
t-on-o-dropzone-files-dropped="_onDropZoneFilesDropped" | ||
t-ref="dropzone" | ||
/> | ||
</t> | ||
</xpath> | ||
</t> | ||
|
||
</templates> |
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 |
---|---|---|
@@ -1,29 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<data> | ||
<record id="res_config_settings_view_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.view.form.inherit.mail</field> | ||
<field name="model">res.config.settings</field> | ||
<field name="inherit_id" ref="mail.res_config_settings_view_form" /> | ||
<field name="arch" type="xml"> | ||
<div id="emails" position="inside"> | ||
<div class="col-xs-12 col-md-6 o_setting_box"> | ||
<div class="o_setting_left_pane"> | ||
<field name="disable_notify_mail_drop_target" /> | ||
</div> | ||
<div class="o_setting_right_pane"> | ||
<label | ||
string="Disable Mail Drag&Drop Notification" | ||
for="disable_notify_mail_drop_target" | ||
/> | ||
<div class="text-muted"> | ||
When a user drops an email into an existing thread | ||
the followers of the thread will not be notified. | ||
</div> | ||
<record id="res_config_settings_view_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.view.form.inherit.mail</field> | ||
<field name="model">res.config.settings</field> | ||
<field name="inherit_id" ref="mail.res_config_settings_view_form" /> | ||
<field name="arch" type="xml"> | ||
<div id="emails" position="inside"> | ||
<div class="col-xs-12 col-md-6 o_setting_box"> | ||
<div class="o_setting_left_pane"> | ||
<field name="disable_notify_mail_drop_target" /> | ||
</div> | ||
<div class="o_setting_right_pane"> | ||
<label | ||
string="Disable Mail Drag&Drop Notification" | ||
for="disable_notify_mail_drop_target" | ||
/> | ||
<div class="text-muted"> | ||
When a user drops an email into an existing thread | ||
the followers of the thread will not be notified. | ||
</div> | ||
</div> | ||
</div> | ||
</field> | ||
</record> | ||
</data> | ||
</div> | ||
</field> | ||
</record> | ||
</odoo> |
This file was deleted.
Oops, something went wrong.