diff options
author | Byron Jones <bjones@mozilla.com> | 2013-12-10 21:30:11 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-12-10 21:30:11 +0100 |
commit | 7d33443002e5da146e506f92600ff456571ac84a (patch) | |
tree | 79b24d20c409ae8ae2b926fe3eac90a9f47a363d /Bugzilla/Comment | |
parent | f21a2d3506d4c4913d0d0a8c1134188a85b76562 (diff) | |
download | bugzilla-7d33443002e5da146e506f92600ff456571ac84a.tar.gz bugzilla-7d33443002e5da146e506f92600ff456571ac84a.tar.xz |
Bug 942725: backport bug 793963 to bmo (add the ability to tag comments with arbitrary tags)
Diffstat (limited to 'Bugzilla/Comment')
-rw-r--r-- | Bugzilla/Comment/TagWeights.pm | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Bugzilla/Comment/TagWeights.pm b/Bugzilla/Comment/TagWeights.pm new file mode 100644 index 000000000..5835efbc4 --- /dev/null +++ b/Bugzilla/Comment/TagWeights.pm @@ -0,0 +1,74 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Comment::TagWeights; + +use 5.10.1; +use strict; + +use parent qw(Bugzilla::Object); + +use Bugzilla::Constants; + +# No auditing required +use constant AUDIT_CREATES => 0; +use constant AUDIT_UPDATES => 0; +use constant AUDIT_REMOVES => 0; + +use constant DB_COLUMNS => qw( + id + tag + weight +); + +use constant UPDATE_COLUMNS => qw( + weight +); + +use constant DB_TABLE => 'longdescs_tags_weights'; +use constant ID_FIELD => 'id'; +use constant NAME_FIELD => 'tag'; +use constant LIST_ORDER => 'weight DESC'; +use constant VALIDATORS => { }; + +sub tag { return $_[0]->{'tag'} } +sub weight { return $_[0]->{'weight'} } + +sub set_weight { $_[0]->set('weight', $_[1]); } + +1; + +=head1 NAME + +Comment::TagWeights - Bugzilla comment weighting class. + +=head1 DESCRIPTION + +TagWeights.pm represents a Comment::TagWeight object. It is an implementation +of L<Bugzilla::Object>, and thus provides all methods that L<Bugzilla::Object> +provides. + +TagWeights is used to quickly find tags and order by their usage count. + +=head1 PROPERTIES + +=over + +=item C<tag> + +C<getter string> The tag + +=item C<weight> + +C<getter int> The tag's weight. The value returned corresponds to the number of +comments with this tag attached. + +=item C<set_weight> + +C<setter int> Set the tag's weight. + +=back |