Procházet zdrojové kódy

! Sent messages should just be saved. Keep it simple, folks. Fixes #716

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer před 10 roky
rodič
revize
69c7cddd13

+ 2 - 8
Sources/Drafts.php

@@ -213,7 +213,6 @@ function SavePMDraft(&$post_errors, $recipientList)
 
 	// prepare the data we got from the form
 	$reply_id = empty($_POST['replied_to']) ? 0 : (int) $_POST['replied_to'];
-	$outbox = empty($_POST['outbox']) ? 0 : 1;
 	$draft['body'] = $smcFunc['htmlspecialchars']($_POST['message'], ENT_QUOTES);
 	$draft['subject'] = strtr($smcFunc['htmlspecialchars']($_POST['subject']), array("\r" => '', "\n" => '', "\t" => ''));
 
@@ -232,8 +231,7 @@ function SavePMDraft(&$post_errors, $recipientList)
 				poster_time = {int:poster_time},
 				subject = {string:subject},
 				body = {string:body},
-				to_list = {string:to_list},
-				outbox = {int:outbox}
+				to_list = {string:to_list}
 			WHERE id_draft = {int:id_pm_draft}
 			LIMIT 1',
 			array(
@@ -244,7 +242,6 @@ function SavePMDraft(&$post_errors, $recipientList)
 				'body' => $draft['body'],
 				'id_pm_draft' => $id_pm_draft,
 				'to_list' => serialize($recipientList),
-				'outbox' => $outbox,
 			)
 		);
 
@@ -265,7 +262,6 @@ function SavePMDraft(&$post_errors, $recipientList)
 				'subject' => 'string-255',
 				'body' => 'string-65534',
 				'to_list' => 'string-255',
-				'outbox' => 'int',
 			),
 			array(
 				$reply_id,
@@ -275,7 +271,6 @@ function SavePMDraft(&$post_errors, $recipientList)
 				$draft['subject'],
 				$draft['body'],
 				serialize($recipientList),
-				$outbox,
 			),
 			array(
 				'id_draft'
@@ -373,7 +368,6 @@ function ReadDraft($id_draft, $type = 0, $check = true, $load = false)
 		elseif ($type === 1)
 		{
 			// one of those pm drafts? then set it up like we have an error
-			$_REQUEST['outbox'] = !empty($draft_info['outbox']);
 			$_REQUEST['subject'] = !empty($draft_info['subject']) ? stripslashes($draft_info['subject']) : '';
 			$_REQUEST['message'] = !empty($draft_info['body']) ? str_replace('<br />', "\n", un_htmlspecialchars(stripslashes($draft_info['body']))) : '';
 			$_REQUEST['replied_to'] = !empty($draft_info['id_reply']) ? $draft_info['id_reply'] : 0;
@@ -745,7 +739,7 @@ function showPMDrafts($memID = -1)
 	// Load in this user's PM drafts
 	$request = $smcFunc['db_query']('', '
 		SELECT
-			ud.id_member, ud.id_draft, ud.body, ud.subject, ud.poster_time, ud.outbox, ud.id_reply, ud.to_list
+			ud.id_member, ud.id_draft, ud.body, ud.subject, ud.poster_time, ud.id_reply, ud.to_list
 		FROM {db_prefix}user_drafts AS ud
 		WHERE ud.id_member = {int:current_member}
 			AND type = {int:draft_type}' . (!empty($modSettings['drafts_keep_days']) ? '

+ 1 - 3
Sources/PersonalMessage.php

@@ -1798,7 +1798,6 @@ function MessagePost()
 	$context['subject'] = $form_subject;
 	$context['message'] = str_replace(array('"', '<', '>', '&nbsp;'), array('&quot;', '&lt;', '&gt;', ' '), $form_message);
 	$context['post_error'] = array();
-	$context['copy_to_outbox'] = !empty($options['copy_to_outbox']);
 
 	// And build the link tree.
 	$context['linktree'][] = array(
@@ -1922,7 +1921,6 @@ function messagePostError($error_types, $named_recipients, $recipient_ids = arra
 	// Set everything up like before....
 	$context['subject'] = isset($_REQUEST['subject']) ? $smcFunc['htmlspecialchars']($_REQUEST['subject']) : '';
 	$context['message'] = isset($_REQUEST['message']) ? str_replace(array('  '), array('&nbsp; '), $smcFunc['htmlspecialchars']($_REQUEST['message'])) : '';
-	$context['copy_to_outbox'] = !empty($_REQUEST['outbox']);
 	$context['reply'] = !empty($_REQUEST['replied_to']);
 
 	if ($context['reply'])
@@ -2298,7 +2296,7 @@ function MessagePost2()
 
 	// Do the actual sending of the PM.
 	if (!empty($recipientList['to']) || !empty($recipientList['bcc']))
-		$context['send_log'] = sendpm($recipientList, $_REQUEST['subject'], $_REQUEST['message'], !empty($_REQUEST['outbox']), null, !empty($_REQUEST['pm_head']) ? (int) $_REQUEST['pm_head'] : 0);
+		$context['send_log'] = sendpm($recipientList, $_REQUEST['subject'], $_REQUEST['message'], true, null, !empty($_REQUEST['pm_head']) ? (int) $_REQUEST['pm_head'] : 0);
 	else
 		$context['send_log'] = array(
 			'sent' => array(),

+ 1 - 4
Themes/default/PersonalMessage.template.php

@@ -1108,9 +1108,6 @@ function template_send()
 
 	// Send, Preview, spellcheck buttons.
 	echo '
-				<p>
-					<label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_save_outbox'], '</label>
-				</p>
 				<hr class="hrcolor" />
 				<span id="post_confirm_strip" class="righttext">
 					', template_control_richedit_buttons($context['post_box_name']), '
@@ -1180,7 +1177,7 @@ function template_send()
 					var x = new Array();
 					var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', \'to\', \'bcc\'];
 					var numericFields = [\'recipient_to[]\', \'recipient_bcc[]\'];
-					var checkboxFields = [\'outbox\'];
+					var checkboxFields = [];
 
 					for (var i = 0, n = textFields.length; i < n; i++)
 						if (textFields[i] in document.forms.postmodify)

+ 1 - 8
Themes/default/Profile.template.php

@@ -1431,7 +1431,7 @@ function template_profile_pm_settings()
 									<label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
 								</dt>
 								<dd>
-									<select name="pm_prefs" id="pm_prefs" onchange="if (this.value == 2 &amp;&amp; !document.getElementById(\'copy_to_outbox\').checked) alert(\'', $txt['pm_recommend_enable_outbox'], '\');">
+									<select name="pm_prefs" id="pm_prefs">
 										<option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
 										<option value="1"', $context['display_mode'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_one'], '</option>
 										<option value="2"', $context['display_mode'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_linked'], '</option>
@@ -1488,13 +1488,6 @@ function template_profile_pm_settings()
 						</dl>
 						<hr />
 						<dl>
-								<dt>
-										<label for="copy_to_outbox"> ', $txt['copy_to_outbox'], '</label>
-								</dt>
-								<dd>
-										<input type="hidden" name="default_options[copy_to_outbox]" value="0" />
-										<input type="checkbox" name="default_options[copy_to_outbox]" id="copy_to_outbox" value="1"', !empty($context['member']['options']['copy_to_outbox']) ? ' checked="checked"' : '', ' class="input_check" />
-								</dd>
 								<dt>
 										<label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label>
 								</dt>

+ 0 - 5
Themes/default/Settings.template.php

@@ -70,11 +70,6 @@ function template_options()
 			'label' => $txt['popup_messages'],
 			'default' => true,
 		),
-		array(
-			'id' => 'copy_to_outbox',
-			'label' => $txt['copy_to_outbox'],
-			'default' => true,
-		),
 		array(
 			'id' => 'pm_remove_inbox_label',
 			'label' => $txt['pm_remove_inbox_label'],

+ 0 - 2
Themes/default/Wireless.template.php

@@ -597,7 +597,6 @@ function template_imode_pm()
 						</tr></td>
 						<tr><td>
 							<input type="submit" value="', $txt['send_message'], '" class="button_submit" />
-							<input type="hidden" name="outbox" value="', $context['copy_to_outbox'] ? '1' : '0', '" />
 							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 							<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
 							<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
@@ -1249,7 +1248,6 @@ function template_wap2_pm()
 					</p>
 					<p class="windowbg">
 						<input type="submit" value="', $txt['send_message'], '" class="button_submit" />
-						<input type="hidden" name="outbox" value="', $context['copy_to_outbox'] ? '1' : '0', '" />
 						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 						<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
 						<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />

+ 0 - 1
Themes/default/languages/PersonalMessage.english.php

@@ -36,7 +36,6 @@ $txt['pm_error_data_limit_reached'] = 'PM could not be sent to \'%1$s\' as their
 $txt['pm_error_user_cannot_read'] = 'User \'%1$s\' can not receive personal messages.';
 $txt['pm_successfully_sent'] = 'PM successfully sent to \'%1$s\'.';
 $txt['pm_send_report'] = 'Send report';
-$txt['pm_save_outbox'] = 'Save a copy in my outbox';
 $txt['pm_undisclosed_recipients'] = 'Undisclosed recipients';
 $txt['pm_too_many_recipients'] = 'You may not send personal messages to more than %1$d recipient(s) at once.';
 

+ 0 - 3
Themes/default/languages/Profile.english.php

@@ -447,15 +447,12 @@ $txt['pm_receive_from_ignore'] = 'All members, except those on my ignore list';
 $txt['pm_receive_from_admins'] = 'Administrators only';
 $txt['pm_receive_from_buddies'] = 'Buddies and Administrators only';
 
-$txt['copy_to_outbox'] = 'Save a copy of each personal message in my sent items by default.';
 $txt['popup_messages'] = 'Show a popup when I receive new messages.';
 $txt['pm_remove_inbox_label'] = 'Remove the inbox label when applying another label';
 $txt['pm_display_mode'] = 'Display personal messages';
 $txt['pm_display_mode_all'] = 'All at once';
 $txt['pm_display_mode_one'] = 'One at a time';
 $txt['pm_display_mode_linked'] = 'As a conversation';
-// Use entities in the below string.
-$txt['pm_recommend_enable_outbox'] = 'To make the most of this setting we suggest you enable &quot;Save a copy of each Personal Message in my sent items by default&quot;\\n\\nThis will help ensure that the conversations flow better as you can see both sides of the conversation.';
 
 $txt['tracking'] = 'Tracking';
 $txt['tracking_description'] = 'This section allows you to review certain profile actions performed on this member\'s profile as well as track their IP address and login history.';

+ 0 - 4
Themes/default/scripts/drafts.js

@@ -151,10 +151,6 @@ smf_DraftAutoSave.prototype.draftPMSave = function ()
 		smf_session_var + '=' + smf_session_id,
 	];
 
-	// Saving a copy in the outbox?
-	if (document.getElementById('outbox'))
-		aSections[aSections.length] = 'outbox=' + parseInt(document.getElementById('outbox').value);
-
 	// account for wysiwyg
 	if (this.opt.sType == 'post')
 		aSections[aSections.length] = 'message_mode=' + parseInt(document.forms.postmodify.elements['message_mode'].value);

+ 0 - 1
other/install_2-1_mysql.sql

@@ -2103,7 +2103,6 @@ CREATE TABLE {$db_prefix}user_drafts (
   locked tinyint(4) NOT NULL default '0',
   is_sticky tinyint(4) NOT NULL default '0',
   to_list varchar(255) NOT NULL default '',
-  outbox tinyint(4) NOT NULL default '0',
   PRIMARY KEY (id_draft),
   UNIQUE id_member (id_member, id_draft, type)
 ) ENGINE=MyISAM;

+ 0 - 1
other/install_2-1_postgresql.sql

@@ -2642,7 +2642,6 @@ CREATE TABLE {$db_prefix}user_drafts (
   locked smallint NOT NULL default '0',
   is_sticky smallint NOT NULL default '0',
   to_list varchar(255) NOT NULL default '',
-  outbox smallint NOT NULL default '0',
   PRIMARY KEY (id_draft)
 );
 

+ 1 - 2
other/install_2-1_sqlite.sql

@@ -2262,8 +2262,7 @@ CREATE TABLE {$db_prefix}user_drafts (
   icon varchar(16) NOT NULL default 'xx',
   locked smallint NOT NULL default '0',
   is_sticky smallint NOT NULL default '0',
-  to_list varchar(255) NOT NULL default '',
-  outbox smallint NOT NULL default '0'
+  to_list varchar(255) NOT NULL default ''
 );
 
 #

+ 1 - 2
other/install_2-1_sqlite3.sql

@@ -2262,8 +2262,7 @@ CREATE TABLE {$db_prefix}user_drafts (
   icon varchar(16) NOT NULL default 'xx',
   locked smallint NOT NULL default '0',
   is_sticky smallint NOT NULL default '0',
-  to_list varchar(255) NOT NULL default '',
-  outbox smallint NOT NULL default '0'
+  to_list varchar(255) NOT NULL default ''
 );
 
 #

+ 0 - 1
other/upgrade_2-1_mysql.sql

@@ -340,7 +340,6 @@ CREATE TABLE IF NOT EXISTS {$db_prefix}user_drafts (
   locked tinyint(4) NOT NULL default '0',
   is_sticky tinyint(4) NOT NULL default '0',
   to_list varchar(255) NOT NULL default '',
-  outbox tinyint(4) NOT NULL default '0',
   PRIMARY KEY id_draft(id_draft),
   UNIQUE id_member (id_member, id_draft, type)
 ) ENGINE=MyISAM{$db_collation};

+ 0 - 1
other/upgrade_2-1_postgresql.sql

@@ -399,7 +399,6 @@ CREATE TABLE {$db_prefix}user_drafts (
 	locked smallint NOT NULL default '0',
 	is_sticky smallint NOT NULL default '0',
 	to_list varchar(255) NOT NULL default '',
-	outbox smallint NOT NULL default '0',
 	PRIMARY KEY (id_draft)
 );
 ---#

+ 0 - 1
other/upgrade_2-1_sqlite.sql

@@ -389,7 +389,6 @@ CREATE TABLE {$db_prefix}user_drafts (
 	locked smallint NOT NULL default '0',
 	is_sticky smallint NOT NULL default '0',
 	to_list varchar(255) NOT NULL default '',
-	outbox smallint NOT NULL default '0',
 	PRIMARY KEY (id_draft)
 );
 ---#