Commit 96e247ce by Scott

Fix sent PMs to show recipient

parent 45d161db
......@@ -645,12 +645,21 @@
// Who wrote it, and their avatar
if (@$options['whoview'])
$fields['who']=qa_lang_html_sub_split('main/by_x', qa_get_one_user_html($message['fromhandle'], false));
if (@$options['avatarsize']>0)
$fields['avatar']=qa_get_user_avatar_html(@$message['fromflags'], @$message['fromemail'], @$message['fromhandle'],
@$message['fromavatarblobid'], @$message['fromavatarwidth'], @$message['fromavatarheight'], $options['avatarsize']);
if (@$options['towhomview']) {
// for sent private messages page (i.e. show who message was sent to)
$fields['who'] = qa_lang_html_sub_split('main/to_x', qa_get_one_user_html($message['tohandle'], false));
$fields['avatar'] = qa_get_user_avatar_html(@$message['toflags'], @$message['toemail'], @$message['tohandle'],
@$message['toavatarblobid'], @$message['toavatarwidth'], @$message['toavatarheight'], $options['avatarsize']);
}
else {
// for everything else (questions, answers, activity, wall messages)
if (@$options['whoview'])
$fields['who'] = qa_lang_html_sub_split('main/by_x', qa_get_one_user_html($message['fromhandle'], false));
if (@$options['avatarsize'] > 0) {
$fields['avatar'] = qa_get_user_avatar_html(@$message['fromflags'], @$message['fromemail'], @$message['fromhandle'],
@$message['fromavatarblobid'], @$message['fromavatarwidth'], @$message['fromavatarheight'], $options['avatarsize']);
}
}
// That's it!
......
......@@ -171,6 +171,7 @@
'suggest_category_qs' => 'To see more, click for all the ^1questions in this category^2.',
'suggest_qs_tags' => 'To see more, click for the ^1full list of questions^2 or ^3popular tags^4.',
'suggest_qs' => 'To see more, click for the ^1full list of questions^2.',
'to_x' => 'to ^',
'unanswered_qs_in_x' => 'Questions without answers in ^',
'unanswered_qs_title' => 'Recent questions without answers',
'unselected_qs_in_x' => 'Questions without a selected answer in ^',
......
......@@ -39,7 +39,7 @@
// Check which box we're showing (inbox/sent), we're not using Q2A's single-sign on integration and that we're logged in
$showInbox = qa_request_part(1) !== 'sent';
$showingInbox = qa_request_part(1) !== 'sent';
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
......@@ -56,7 +56,7 @@
// Find the user profile and questions and answers for this handle
$pmSpec = $showInbox
$pmSpec = $showingInbox
? qa_db_messages_inbox_selectspec('private', $loginUserId, true)
: qa_db_messages_outbox_selectspec('private', $loginUserId, true);
......@@ -66,29 +66,33 @@
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = $showInbox ? qa_lang_html('misc/pm_inbox_title') : qa_lang_html('misc/pm_outbox_title');
$qa_content['title'] = $showingInbox ? qa_lang_html('misc/pm_inbox_title') : qa_lang_html('misc/pm_outbox_title');
$qa_content['message_list'] = array(
'tags' => 'id="privatemessages"',
'messages' => array(),
);
$options = qa_message_html_defaults();
$htmlDefaults = qa_message_html_defaults();
if (!$showingInbox) {
$htmlDefaults['towhomview'] = true;
}
foreach ($userMessages as $message) {
$qa_content['message_list']['messages'][] = qa_message_html_fields($message, $options);
$qa_content['message_list']['messages'][] = qa_message_html_fields($message, $htmlDefaults);
}
$qa_content['navigation']['sub'] = array(
'inbox' => array(
'label' => qa_lang_html('misc/inbox'),
'url' => qa_path_html('messages'),
'selected' => $showInbox,
'selected' => $showingInbox,
),
'outbox' => array(
'label' => qa_lang_html('misc/outbox'),
'url' => qa_path_html('messages/sent'),
'selected' => !$showInbox,
'selected' => !$showingInbox,
)
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment