The "Browse" link in the page header/footer doesn't sort products by classification

RESOLVED FIXED in Bugzilla 4.4

Status

()

--
enhancement
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: gidelson, Assigned: LpSolit)

Tracking

4.2.2
Bugzilla 4.4
Bug Flags:
approval +

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

Steps to reproduce:

enable classification and define some classifications with some products in them


Actual results:

when I choose to submit new bug , it let me choose classification first , or to press all products to see all products with classification titles.
When I choose "browse" it automatically shows me all products without showing me classifications at all.


Expected results:

Browse button should show me classifications list if classification is enabled.
(Assignee)

Comment 1

6 years ago
I agree it should.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 2

6 years ago
describecomponents.cgi never took care of classifications, see bug 365064 comment 3.
Assignee: administration → LpSolit
Severity: normal → enhancement
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 4.4
(Assignee)

Comment 3

6 years ago
Created attachment 648318 [details] [diff] [review]
patch, v1

As the code to sort products per classification was the same in enter_bug.cgi and describecomponents.cgi, I refactored the code into a subroutine in Bugzilla::Classification. This avoids duplicating the code.
Attachment #648318 - Flags: review?(dkl)
(Assignee)

Updated

6 years ago
Component: Administration → User Interface
Summary: Browse ignore classification → The "Browse" link in the page header/footer doesn't sort products by classification
Comment on attachment 648318 [details] [diff] [review]
patch, v1

Review of attachment 648318 [details] [diff] [review]:
-----------------------------------------------------------------

The rest looks good and works as expected. Suggested changes can be made on commit if agreed. r=dkl

::: describecomponents.cgi
@@ +13,4 @@
>  use Bugzilla::Constants;
>  use Bugzilla::Util;
>  use Bugzilla::Error;
> +use Bugzilla::Classification;

Nit: 
use Bugzilla::Classification qw(sort_products);

In case the module ever exports other methods that are not really relevant here. describecomponents isn't using anything else from the module.

@@ +41,4 @@
>      # product only, to not confuse the user with components of a
>      # product he didn't request.
>      elsif (scalar(@products) > 1 || $product_name) {
> +        $vars->{'classifications'} = sort_products(\@products);

I feel the function name needs to be named differently. sort_products() makes me think it is just returning a sorted list of the same product objects. Since you are returning sorted products based on classification, maybe it should be named sort_products_by_classification() or something similarly descriptive.

::: enter_bug.cgi
@@ +64,4 @@
>      my @classifications;
>  
>      unless ($classification && $classification ne '__all') {
> +        @classifications = @{sort_products(\@enterable_products)};

same here
Attachment #648318 - Flags: review?(dkl) → review+
(Assignee)

Comment 5

6 years ago
(In reply to David Lawrence [:dkl] from comment #4)
> use Bugzilla::Classification qw(sort_products);
> 
> In case the module ever exports other methods that are not really relevant
> here. describecomponents isn't using anything else from the module.

We do it in no other .cgi script. We always load Bugzilla modules without specifying what we want. So I will follow this path here too.


> maybe it should be named sort_products_by_classification() or something

I thought about that too, but I wanted to keep the name short. I can use your suggestion, though, the name is fine. I will the name on checkin.
Flags: approval+
(Assignee)

Comment 6

6 years ago
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified describecomponents.cgi
modified enter_bug.cgi
modified Bugzilla/Classification.pm
Committed revision 8356.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.