Commit d6aacfb2 authored by iamEAP's avatar iamEAP Committed by greggles

Issue #1279470 by iamEAP: Schema mismatch in comment_notify upgrades

parent ed562bb8
......@@ -166,3 +166,19 @@ function comment_notify_update_7003() {
function comment_notify_update_7004() {
db_change_field('comment_notify', 'notified', 'notified', array('type' => 'int', 'size' => 'small', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
}
/**
* Fix minor schema inconsistencies caused by the last update.
*/
function comment_notify_update_7005() {
// Previous update altered size and unsigned unnecessarily.
$notified_field = array(
'type' => 'int',
'description' => 'A boolean indicator for whether or not a notification for the comment has been sent: 1 means yes, 0 means no.',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
);
db_change_field('comment_notify', 'notified', 'notified', $notified_field);
}
......@@ -131,7 +131,7 @@ function comment_notify_form_comment_form_alter(&$form, &$form_state, $form_id)
$form['notify_settings']['notify_type'] = array(
'#type' => 'radios',
'#options' => $available_options,
'#default_value' => $preference ? $preference : NULL,
'#default_value' => $preference ? $preference : 1,
);
if (count($available_options) == 1) {
$form['notify_settings']['notify_type']['#type'] = 'hidden';
......@@ -146,7 +146,7 @@ function comment_notify_form_comment_form_alter(&$form, &$form_state, $form_id)
$notify = comment_notify_get_notification_type($form['cid']['#value']);
$form['notify_settings']['notify']['#default_value'] = (bool) $notify;
if (count($available_options) > 1) {
$form['notify_settings']['notify_type']['#default_value'] = $notify;
$form['notify_settings']['notify_type']['#default_value'] = empty($notify) ? COMMENT_NOTIFY_NODE : $notify;
}
else {
$form['notify_settings']['notify_type']['#default_value'] = key($available_options);
......
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