Skip to content

Commit

Permalink
User preference UI for full issue details in email
Browse files Browse the repository at this point in the history
Fixes #21876
  • Loading branch information
vboctor committed Nov 13, 2016
1 parent b63ff25 commit b8b406a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions account_prefs_inc.php
Expand Up @@ -82,6 +82,7 @@ function edit_account_prefs( $p_user_id = null, $p_error_if_protected = true, $p
}

$t_pref = user_pref_get( $p_user_id );
$t_email_full_issue = (int)config_get( 'email_notifications_verbose', /* default */ null, $p_user_id, ALL_PROJECTS );

# Account Preferences Form BEGIN
?>
Expand Down Expand Up @@ -261,6 +262,13 @@ function edit_account_prefs( $p_user_id = null, $p_error_if_protected = true, $p
</span>
<span class="label-style"></span>
</div>
<fieldset class="field-container">
<legend><label for="email-full-issue"><?php echo lang_get( 'email_full_issue_details' ) ?></label></legend>
<span class="checkbox">
<input id="email-full-issue" type="checkbox" name="email_full_issue" <?php check_checked( $t_email_full_issue, ON ); ?> />
</span>
<span class="label-style"></span>
</fieldset>
<?php } else { ?>
<input type="hidden" name="email_on_new" value="<?php echo $t_pref->email_on_new ?>" />
<input type="hidden" name="email_on_assigned" value="<?php echo $t_pref->email_on_assigned ?>" />
Expand All @@ -281,6 +289,7 @@ function edit_account_prefs( $p_user_id = null, $p_error_if_protected = true, $p
<input type="hidden" name="email_on_status_min_severity" value="<?php echo $t_pref->email_on_status_min_severity ?>" />
<input type="hidden" name="email_on_priority_min_severity" value="<?php echo $t_pref->email_on_priority_min_severity ?>" />
<input type="hidden" name="email_bugnote_limit" value="<?php echo $t_pref->email_bugnote_limit ?>" />
<input type="hidden" name="email_full_issue" value="<?php echo $t_email_full_issue ?>" />
<?php } ?>
<div class="field-container">
<label for="timezone"><span><?php echo lang_get( 'timezone' ) ?></span></label>
Expand Down
7 changes: 7 additions & 0 deletions account_prefs_update.php
Expand Up @@ -106,6 +106,13 @@
$t_prefs->bugnote_order = gpc_get_string( 'bugnote_order' );
$t_prefs->email_bugnote_limit = gpc_get_int( 'email_bugnote_limit' );

# Save user preference with regards to getting full issue details in notifications or not.
$t_email_full_issue = gpc_get_bool( 'email_full_issue' ) ? 1 : 0;
$t_email_full_config_option = 'email_notifications_verbose';
if( config_get( $t_email_full_config_option, /* default */ null, $f_user_id, ALL_PROJECTS ) != $t_email_full_issue ) {
config_set( $t_email_full_config_option, $t_email_full_issue, $f_user_id, ALL_PROJECTS );
}

# make sure the delay isn't too low
if( ( config_get( 'min_refresh_delay' ) > $t_prefs->refresh_delay )&&
( $t_prefs->refresh_delay != 0 )) {
Expand Down
1 change: 1 addition & 0 deletions lang/strings_english.txt
Expand Up @@ -409,6 +409,7 @@ $s_email_on_bugnote_added = 'E-mail on Note Added';
$s_email_on_status_change = 'E-mail on Status Change';
$s_email_on_priority_change = 'E-mail on Priority Change';
$s_email_bugnote_limit = 'E-mail Notes Limit';
$s_email_full_issue_details = 'E-mail Full Issue Details';
$s_language = 'Language';
$s_update_prefs_button = 'Update Prefs';
$s_reset_prefs_button = 'Reset Prefs';
Expand Down

0 comments on commit b8b406a

Please sign in to comment.