(rl => {
// if (rl.settings.get('Nextcloud'))
const
templateId = 'MailMessageView';
// DATA_IMAGE_USER_DOT_PIC = 'data:image/svg+xml;utf8,';
addEventListener('rl-view-model.create', e => {
if (templateId === e.detail.viewModelTemplateID) {
const
template = document.getElementById(templateId),
messageItemHeader = template.content.querySelector('.messageItemHeader');
if (messageItemHeader) {
messageItemHeader.prepend(Element.fromHTML(
``
));
}
let view = e.detail;
view.viewUserPic = ko.observable('');
view.viewUserPicVisible = ko.observable(false);
view.message.subscribe(msg => {
if (msg) {
let from = msg.from[0],
bimi = 'pass' == from.dkimStatus ? 1 : 0;
// view.viewUserPic(`?Avatar/${bimi}/${encodeURIComponent(from.email)}`);
rl.pluginRemoteRequest((iError, data) => {
if (!iError && data?.Result.type) {
view.viewUserPic(`data:${data.Result.type};base64,${data.Result.data}`);
view.viewUserPicVisible(true);
}
}, 'Avatar', {
bimi: bimi,
email: from.email
});
}
});
}
});
})(window.rl);