Skip to content
Browse files

Issue #1307948 - In some conditions, status privacy is incorrectly lo…

…aded by ezra-g
  • Loading branch information...
1 parent c92f4e0 commit 238cb3a40b5d0c3d63d288f8c57ead0e4ca77053 @IceCreamYou committed
View
1 facebook_status.module
@@ -776,6 +776,7 @@ function facebook_status_save_status($recipient, $type, $message, $sender = NULL
'sender' => $sender->uid,
'recipient' => $recipient_id,
'type' => $type,
+ 'private' => isset($options['form_state']['values']['private']) ? $options['form_state']['values']['private'] : 0,
);
if ($message != $status->message || $type != $status->type || $recipient_id != $status->recipient || !$options['discard duplicates']) {
$edit = FALSE;
View
14 submodules/fbss_privacy/fbss_privacy.install
@@ -6,6 +6,20 @@
*/
/**
+ * Implementation of hook_schema_alter().
+ */
+function fbss_privacy_schema_alter(&$schema) {
+ $schema['facebook_status']['fields']['private'] = array(
+ 'type' => 'int',
+ 'size' => 'tiny',
+ 'unsigned' => TRUE,
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => 'Whether the status is private (1) or not (0).',
+ );
+}
+
+/**
* Implementation of hook_install().
*/
function fbss_privacy_install() {
View
11 submodules/fbss_privacy/fbss_privacy.module
@@ -35,6 +35,7 @@ function fbss_privacy_form_facebook_status_box_alter(&$form, &$form_state) {
return;
}
drupal_add_css(drupal_get_path('module', 'fbss_privacy') .'/fbss_privacy.css');
+ // This value gets saved in facebook_status_save_status() so we don't need a separate submit handler.
$form['private'] = array(
'#type' => 'checkbox',
'#title' => t('Private'),
@@ -43,16 +44,6 @@ function fbss_privacy_form_facebook_status_box_alter(&$form, &$form_state) {
'#prefix' => '<div class="facebook-status-private-box">',
'#suffix' => '</div>',
);
- $form['fbss-submit']['#submit'][] = 'fbss_privacy_facebook_status_box_submit';
-}
-
-/**
- * Submit callback for the Privacy checkbox.
- */
-function fbss_privacy_facebook_status_box_submit($form, $form_state) {
- if (!empty($form_state['values']['private']) && user_access('send private status messages')) {
- db_query("UPDATE {facebook_status} SET private = %d WHERE sid = %d", $form_state['values']['private'], $form_state['facebook_status']['sid']);
- }
}
/**

0 comments on commit 238cb3a

Please sign in to comment.
Something went wrong with that request. Please try again.