Fix mail avatar not being set correctly for sent folder messages

This commit is contained in:
Hadi Nategh 2022-09-22 14:06:04 +02:00
parent 6c9d6fd13f
commit be3b38d516
5 changed files with 49 additions and 22 deletions

View File

@ -2114,17 +2114,21 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
if ($header['disposition-notification-to']) $data['dispositionnotificationto'] = $header['disposition-notification-to']; if ($header['disposition-notification-to']) $data['dispositionnotificationto'] = $header['disposition-notification-to'];
if (($header['mdnsent']||$header['mdnnotsent']|$header['seen'])&&isset($data['dispositionnotificationto'])) unset($data['dispositionnotificationto']); if (($header['mdnsent']||$header['mdnnotsent']|$header['seen'])&&isset($data['dispositionnotificationto'])) unset($data['dispositionnotificationto']);
$data['attachmentsBlock'] = $imageHTMLBlock; $data['attachmentsBlock'] = $imageHTMLBlock;
$data['address'] = ($_folderType?$data["toaddress"]:$data["fromaddress"]); if ($_folderType)
$email = Mail::stripRFC822Addresses(array($data['address'])); {
$fromcontact = self::getContactFromAddress($data['fromaddress']);
if (!empty($fromcontact))
{
$data['fromavatar'] = self::getContactFromAddress($data['fromaddress'])[0]['photo'];
}
}
$data['address'] = ($_folderType ? $data["toaddress"] : $data["fromaddress"]);
$contact = $GLOBALS['egw']->contacts->search( $contact = self::getContactFromAddress($data['address']);
array('contact_email' => $email[0], 'contact_email_home' => $email[0]),
array('contact_id', 'email', 'email_home', 'n_fn'),
'', '', '', false, 'OR', false
);
if (!empty($contact)) if (!empty($contact))
{ {
$data['avatar'] = $contact[0]['photo']; $data['avatar'] = $contact[0]['photo'];
if (!$_folderType) $data['fromavatar'] = $data['avatar'];
} }
if (in_array("bodypreview", $cols)&&$header['bodypreview']) if (in_array("bodypreview", $cols)&&$header['bodypreview'])
@ -2329,10 +2333,33 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
} }
// send configured image proxy to client-side // send configured image proxy to client-side
$content['image_proxy'] = self::image_proxy(); $content['image_proxy'] = self::image_proxy();
$contact = self::getContactFromAddress($content['from'][0]);
$etpl->exec('mail.mail_ui.displayMessage',$content,$sel_options,$readonlys,$preserv,2); if (!empty($contact))
{
$content['avatar'] = $contact[0]['photo'];
} }
$etpl->exec('mail.mail_ui.displayMessage', $content, $sel_options, $readonlys, $preserv, 2);
}
/**
* Retrive contact info from a given address
* @param $address
* @return mixed
*/
static function getContactFromAddress(string $address)
{
$email = Mail::stripRFC822Addresses([$address]);
return $GLOBALS['egw']->contacts->search(
array('contact_email' => $email[0], 'contact_email_home' => $email[0]),
array('contact_id', 'email', 'email_home', 'n_fn'),
'', '', '', false, 'OR', false
);
}
/** /**
* This is a helper function to trigger Push method * This is a helper function to trigger Push method
* faster than normal 60 sec cycle. * faster than normal 60 sec cycle.

View File

@ -20,7 +20,7 @@
</hbox> </hbox>
<hbox width="100%" class="mailPreviewHeaders"> <hbox width="100%" class="mailPreviewHeaders">
<lavatar src="@avatar" lname="@address" shape="rounded"/> <lavatar src="@avatar" lname="@from[0]" shape="rounded"/>
<vbox class="previewWrapper"> <vbox class="previewWrapper">
<hbox> <hbox>
<et2-details class="details" title="details" toggleOnHover="true" hoist="true" toggleAlign="left"> <et2-details class="details" title="details" toggleOnHover="true" hoist="true" toggleAlign="left">

View File

@ -36,7 +36,7 @@
</hbox> </hbox>
</hbox> </hbox>
<hbox width="100%" class="mailPreviewHeaders"> <hbox width="100%" class="mailPreviewHeaders">
<lavatar src="@avatar" lname="@address" shape="rounded" size="2.75em"/> <lavatar src="@fromavatar" lname="@fromaddress" shape="rounded" size="2.75em"/>
<vbox> <vbox>
<hbox> <hbox>
<et2-details class="details" toggleOnHover="true" hoist="true" toggleAlign="left"> <et2-details class="details" toggleOnHover="true" hoist="true" toggleAlign="left">

View File

@ -31,21 +31,21 @@
padding: 1px 8px 0 8px; padding: 1px 8px 0 8px;
background: none; background: none;
} }
body #popupMainDiv div.et2_toolbar.et2_head_toolbar { body #popupMainDiv .et2_toolbar.et2_head_toolbar {
padding: 1px 5px 5px 10px !important; padding: 1px 5px 5px 10px !important;
} }
body #popupMainDiv div.et2_toolbar.et2_head_toolbar button { body #popupMainDiv .et2_toolbar.et2_head_toolbar et2-button {
width: 46px; width: 46px;
height: 46px; height: 46px;
background-size: 18px 18px; background-size: 18px 18px;
} }
body #popupMainDiv div.et2_toolbar.et2_head_toolbar button.et2_toolbar_hasCaption { body #popupMainDiv .et2_toolbar.et2_head_toolbar .et2_toolbar_hasCaption {
width: auto; width: auto;
} }
body #popupMainDiv div.et2_toolbar.et2_head_toolbar div.et2_toolbar_actionlist { body #popupMainDiv .et2_toolbar.et2_head_toolbar .et2_toolbar_actionlist {
margin-left: 50px; margin-left: 50px;
} }
body #popupMainDiv #mail-compose_composeToolbar button#composeToolbar-send { body #popupMainDiv #mail-compose_composeToolbar #composeToolbar-send {
height: 46px; height: 46px;
width: auto; width: auto;
margin-top: 0.7px !important; margin-top: 0.7px !important;
@ -60,11 +60,11 @@
background-color: #fafafa; background-color: #fafafa;
color: black; color: black;
} }
body #popupMainDiv #mail-compose_composeToolbar button#composeToolbar-send:hover { body #popupMainDiv #mail-compose_composeToolbar #composeToolbar-send:hover {
box-shadow: none; box-shadow: none;
background-color: none; background-color: none;
} }
body #popupMainDiv #mail-compose_composeToolbar button#composeToolbar-send:disabled { body #popupMainDiv #mail-compose_composeToolbar #composeToolbar-send:disabled {
background-color: none; background-color: none;
} }
body #popupMainDiv .mail-d-h1 { body #popupMainDiv .mail-d-h1 {

View File

@ -39,24 +39,24 @@
padding: 1px 8px 0 8px; padding: 1px 8px 0 8px;
background: none; background: none;
div.et2_toolbar.et2_head_toolbar { .et2_toolbar.et2_head_toolbar {
padding: 1px 5px 5px 10px !important; padding: 1px 5px 5px 10px !important;
button { et2-button {
width:46px; width:46px;
height:46px; height:46px;
background-size: 18px 18px; background-size: 18px 18px;
} }
button.et2_toolbar_hasCaption { .et2_toolbar_hasCaption {
width:auto; width:auto;
} }
div.et2_toolbar_actionlist { .et2_toolbar_actionlist {
margin-left: 50px; margin-left: 50px;
} }
} }
#mail-compose_composeToolbar{ #mail-compose_composeToolbar{
// Senden Button // Senden Button
button#composeToolbar-send{ #composeToolbar-send{
height: 46px; height: 46px;
width: auto; width: auto;
margin-top: 0.7px !important; margin-top: 0.7px !important;