Skip to content

Commit b21167f

Browse files
committed
Bug 1209599 - group general preferences by category (schema only)
1 parent 2e2981d commit b21167f

File tree

3 files changed

+132
-34
lines changed

3 files changed

+132
-34
lines changed

Bugzilla/DB/Schema.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,7 @@ use constant ABSTRACT_SCHEMA => {
16181618
is_enabled => {TYPE => 'BOOLEAN', NOTNULL => 1,
16191619
DEFAULT => 'TRUE'},
16201620
subclass => {TYPE => 'varchar(32)'},
1621+
category => {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "'General'"}
16211622
],
16221623
},
16231624

Bugzilla/Install.pm

Lines changed: 117 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,51 +56,133 @@ use constant STATUS_WORKFLOW => (
5656
);
5757

5858
sub SETTINGS {
59-
return {
59+
return [
6060
# 2005-03-03 travis@sedsystems.ca -- Bug 41972
61-
display_quips => { options => ["on", "off"], default => "on" },
61+
{
62+
name => 'display_quips',
63+
options => ["on", "off"],
64+
default => "on",
65+
category => 'Searching'
66+
},
6267
# 2005-03-10 travis@sedsystems.ca -- Bug 199048
63-
comment_sort_order => { options => ["oldest_to_newest", "newest_to_oldest",
64-
"newest_to_oldest_desc_first"],
65-
default => "oldest_to_newest" },
68+
{
69+
name => 'comment_sort_order',
70+
options => ["oldest_to_newest", "newest_to_oldest", "newest_to_oldest_desc_first"],
71+
default => "oldest_to_newest",
72+
category => 'Bug Editing'
73+
},
6674
# 2005-05-12 bugzilla@glob.com.au -- Bug 63536
67-
post_bug_submit_action => { options => ["next_bug", "same_bug", "nothing"],
68-
default => "next_bug" },
75+
{
76+
name => 'post_bug_submit_action',
77+
options => ["next_bug", "same_bug", "nothing"],
78+
default => "next_bug",
79+
category => 'Bug Editing'
80+
},
6981
# 2005-06-29 wurblzap@gmail.com -- Bug 257767
70-
csv_colsepchar => { options => [',',';'], default => ',' },
82+
{
83+
name => 'csv_colsepchar',
84+
options => [',',';'],
85+
default => ',',
86+
category => 'Searching'
87+
},
7188
# 2005-10-26 wurblzap@gmail.com -- Bug 291459
72-
zoom_textareas => { options => ["on", "off"], default => "on" },
89+
{
90+
name => 'zoom_textareas',
91+
options => ["on", "off"],
92+
default => "on",
93+
category => 'Bug Editing'
94+
},
7395
# 2005-10-21 LpSolit@gmail.com -- Bug 313020
74-
per_bug_queries => { options => ['on', 'off'], default => 'off' },
96+
{
97+
name => 'per_bug_queries',
98+
options => ['on', 'off'],
99+
default => 'off',
100+
category => 'Searching'
101+
},
75102
# 2006-05-01 olav@bkor.dhs.org -- Bug 7710
76-
state_addselfcc => { options => ['always', 'never', 'cc_unless_role'],
77-
default => 'cc_unless_role' },
103+
{
104+
name => 'state_addselfcc',
105+
options => ['always', 'never', 'cc_unless_role'],
106+
default => 'cc_unless_role',
107+
category => 'Bug Editing'
108+
},
78109
# 2006-08-04 wurblzap@gmail.com -- Bug 322693
79-
skin => { subclass => 'Skin', default => 'Dusk' },
110+
{
111+
name => 'skin',
112+
subclass => 'Skin',
113+
default => 'Dusk',
114+
category => 'User Interface'
115+
},
80116
# 2006-12-10 LpSolit@gmail.com -- Bug 297186
81-
lang => { subclass => 'Lang',
82-
default => ${Bugzilla->languages}[0] },
117+
{
118+
name => 'lang',
119+
subclass => 'Lang',
120+
default => ${Bugzilla->languages}[0],
121+
category => 'User Interface'
122+
},
83123
# 2007-07-02 altlist@gmail.com -- Bug 225731
84-
quote_replies => { options => ['quoted_reply', 'simple_reply', 'off'],
85-
default => "quoted_reply" },
124+
{
125+
name => 'quote_replies',
126+
options => ['quoted_reply', 'simple_reply', 'off'],
127+
default => "quoted_reply",
128+
category => 'Bug Editing'
129+
},
86130
# 2009-02-01 mozilla@matt.mchenryfamily.org -- Bug 398473
87-
comment_box_position => { options => ['before_comments', 'after_comments'],
88-
default => 'before_comments' },
131+
{
132+
name => 'comment_box_position',
133+
options => ['before_comments', 'after_comments'],
134+
default => 'before_comments',
135+
category => 'Bug Editing'
136+
},
89137
# 2008-08-27 LpSolit@gmail.com -- Bug 182238
90-
timezone => { subclass => 'Timezone', default => 'local' },
138+
{
139+
name => 'timezone',
140+
subclass => 'Timezone',
141+
default => 'local',
142+
category => 'User Interface'
143+
},
91144
# 2011-02-07 dkl@mozilla.com -- Bug 580490
92-
quicksearch_fulltext => { options => ['on', 'off'], default => 'on' },
145+
{
146+
name => 'quicksearch_fulltext',
147+
options => ['on', 'off'],
148+
default => 'on',
149+
category => 'Searching'
150+
},
93151
# 2011-06-21 glob@mozilla.com -- Bug 589128
94-
email_format => { options => ['html', 'text_only'],
95-
default => 'html' },
152+
{
153+
name => 'email_format',
154+
options => ['html', 'text_only'],
155+
default => 'html',
156+
category => 'Email Notifications'
157+
},
96158
# 2011-06-16 glob@mozilla.com -- Bug 663747
97-
bugmail_new_prefix => { options => ['on', 'off'], default => 'on' },
159+
{
160+
name => 'bugmail_new_prefix',
161+
options => ['on', 'off'],
162+
default => 'on',
163+
category => 'Email Notifications'
164+
},
98165
# 2013-07-26 joshi_sunil@in.com -- Bug 669535
99-
possible_duplicates => { options => ['on', 'off'], default => 'on' },
166+
{
167+
name => 'possible_duplicates',
168+
options => ['on', 'off'],
169+
default => 'on',
170+
category => 'User Interface'
171+
},
100172
# 2011-10-11 glob@mozilla.com -- Bug 301656
101-
requestee_cc => { options => ['on', 'off'], default => 'on' },
102-
api_key_only => { options => ['on', 'off'], default => 'off' },
103-
}
173+
{
174+
name => 'requestee_cc',
175+
options => ['on', 'off'],
176+
default => 'on',
177+
category => 'Reviews and Needinfo'
178+
},
179+
{
180+
name => 'api_key_only',
181+
options => ['on', 'off'],
182+
default => 'off',
183+
category => 'API'
184+
},
185+
];
104186
};
105187

106188
use constant SYSTEM_GROUPS => (
@@ -198,12 +280,13 @@ sub update_settings {
198280
print get_text('install_setting_setup'), "\n";
199281
}
200282

201-
my %settings = %{SETTINGS()};
202-
foreach my $setting (keys %settings) {
203-
add_setting($setting,
204-
$settings{$setting}->{options},
205-
$settings{$setting}->{default},
206-
$settings{$setting}->{subclass}, undef,
283+
my @settings = @{SETTINGS()};
284+
foreach my $setting (@settings) {
285+
add_setting($setting->{name},
286+
$setting->{options},
287+
$setting->{default},
288+
$setting->{subclass},
289+
undef,
207290
!$any_settings);
208291
}
209292
}

Bugzilla/Install/DB.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,8 @@ sub update_table_definitions {
759759
$dbh->bz_add_column('groups', 'idle_member_removal',
760760
{TYPE => 'INT2', NOTNULL => 1, DEFAULT => '0'});
761761

762+
_migrate_preference_categories();
763+
762764
################################################################
763765
# New --TABLE-- changes should go *** A B O V E *** this point #
764766
################################################################
@@ -3896,6 +3898,18 @@ sub _migrate_group_owners {
38963898
$dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id);
38973899
}
38983900

3901+
sub _migrate_preference_categories {
3902+
my $dbh = Bugzilla->dbh;
3903+
return if $dbh->bz_column_info('setting', 'category');
3904+
$dbh->bz_add_column('setting', 'category',
3905+
{TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "'General'"});
3906+
my @settings = @{ Bugzilla::Install::SETTINGS() };
3907+
foreach my $params (@settings) {
3908+
$dbh->do('UPDATE setting SET category = ? WHERE name = ?',
3909+
undef, $params->{category}, $params->{name});
3910+
}
3911+
}
3912+
38993913
1;
39003914

39013915
__END__

0 commit comments

Comments
 (0)