[Rt-commit] rtir branch, 4.2/restore-previous-menu-2, created. 4.0.1rc1-131-g15bb25c9

Blaine Motsinger blaine at bestpractical.com
Thu May 14 19:53:42 EDT 2020


The branch, 4.2/restore-previous-menu-2 has been created
        at  15bb25c98cfb1bf12ee547ad6d44c4c93a80ae60 (commit)

- Log -----------------------------------------------------------------
commit 9c64af32380f89a98c5e3f5414434bdf828aeedb
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu Mar 26 18:39:00 2020 -0500

    Restore RTIR menu into single parent
    
    This commit restores the menu structure from RTIR 3.2 where the
    RTIR options all live under a single parent.
    
    In addition to causing issues with other extensions that modify the
    menu, the expanded RTIR menus make accessing RT menu items more
    difficult.  The RTIR items each only contain a single entry to
    create a ticket compared to the RT menu items which contain more
    options and sub menus.

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index c8a2f21f..f932345b 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -47,11 +47,6 @@
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
 
-if ( $m->request_comp->path !~ m{^/RTIR/} ) {
-    Menu()->child( rtir => title => loc('RTIR'), path => RT::IR->HREFTo('', IncludeWebPath => 0) );
-    return;
-}
-
 my $query_string = sub {
     my %args = @_;
     my $u    = URI->new();
@@ -75,22 +70,9 @@ my $search_arguments = sub {
     return %res;
 };
 
+my $root = Menu->child( rtir => title => loc('RTIR'), path => '/RTIR/' );
 
-my $orig_menu = Menu();
-
-$HTML::Mason::Commands::m->notes('menu', RT::Interface::Web::Menu->new());
-
-my $rtmenu = Menu->child(rtkids => menu => $orig_menu);
-$rtmenu->title(loc('RT'));
-$rtmenu->path('/');
-$rtmenu->key('rt-menu');
-
-Menu->child(preferences => menu => $orig_menu->child('preferences'));
-$orig_menu->delete('preferences');
-
-my $root = Menu();
-
-my $search = $root->child( search => title => loc('RTIR'), path => RT::IR->HREFTo('', IncludeWebPath => 0) );
+my $search = $root->child( search => title => loc('Search'), path => RT::IR->HREFTo('', IncludeWebPath => 0) );
 $search->child( new => title => loc('New Search'), path => RT::IR->HREFTo('Search/?NewQuery=1', IncludeWebPath => 0) );
 
 {
diff --git a/html/RTIR/Tools/index.html b/html/RTIR/Tools/index.html
index 3b0f4024..d49861a5 100644
--- a/html/RTIR/Tools/index.html
+++ b/html/RTIR/Tools/index.html
@@ -47,5 +47,5 @@
 %# END BPS TAGGED BLOCK }}}
 <& /RTIR/Elements/Header, Title => loc('RTIR Tools') &>
 <& /Elements/Tabs &>
-<& /Elements/ListMenu, menu => Menu()->child('tools')  &>
+<& /Elements/ListMenu, menu => Menu()->child('rtir')->child('tools')  &>
 

commit 39a3da5449ac0d26edc11862361a21978e4251ad
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Apr 9 11:18:46 2020 -0400

    Align menu item with queue name for Incident Reports

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index f932345b..75211dd2 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -95,7 +95,7 @@ $root->child(
     path => RT::IR->HREFTo('CreateInQueue.html?Lifecycle='.RT::IR->lifecycle_incident, IncludeWebPath => 0),
 );
 $root->child(
-    reports => title => loc('Reports'),
+    reports => title => loc('Incident Reports'),
     path => RT::IR->HREFTo('Search/Results.html?Lifecycle='. RT::IR->lifecycle_report, IncludeWebPath => 0)
 )->child(
     create => title => loc('Create'),

commit 520265b98cf03e6131603f88af5571c7c27fd295
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Apr 9 11:47:28 2020 -0400

    Explain menu change in UPGRADING doc

diff --git a/docs/UPGRADING-5.0 b/docs/UPGRADING-5.0
new file mode 100644
index 00000000..e4e5d081
--- /dev/null
+++ b/docs/UPGRADING-5.0
@@ -0,0 +1,22 @@
+=head1 Upgrading to 5.0
+
+The following describes some of the key components of the upgrade
+to RTIR 5.0 from earlier versions. The other UPGRADING documents contain
+details for previous versions.
+
+=head2 Notable Changes
+
+=over
+
+=item *
+
+In RTIR 4.0, we modified the menu display to move each queue to a
+top level menu item when working inside RTIR. Each menu ended up
+having just a "Create" entry and we haven't found new menu items
+to add for each queue. This change made it harder to access the
+default RT menus, so we have reverted to the previous configuration
+with a single RTIR menu item containing relevant links.
+
+=back
+
+=cut

commit 56765d4e0f9686cc4d0d447f4c13ba1bd86d151b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Apr 29 17:05:48 2020 -0400

    Load incident create page without a queue
    
    Allow the incident create page to load even when no queue is
    passed by defaulting to the first queue with an incident lifecycle.
    
    Since 7b96b55e6 moved queue selection to the create page, users
    can select a different queue from the page if needed.

diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 186c9e08..5e587e28 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -130,7 +130,7 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
       <&|/l&>Queue</&>:
     </div>
     <div class="value col-md-9">
-      <& /RTIR/Elements/SelectRTIRQueue, Name => "Queue", Default => $ARGS{Queue}, AutoSubmit => 1, ShowNullOption => 0 &>
+      <& /RTIR/Elements/SelectRTIRQueue, Name => "Queue", Default => $queue, AutoSubmit => 1, ShowNullOption => 0 &>
     </div>
   </div>
   <div class="form-row">
@@ -363,12 +363,27 @@ for my $related_ticket ($ChildObj, $SplitObj) {
         last;
 }
 
+# Load the first Incident queue if none is provided
+my $queue = $ARGS{'Queue'};
+unless ( $queue ) {
+    my $queues = RT::Queues->new( RT->SystemUser );
+
+    $queues->Limit(
+        FIELD => 'Lifecycle',
+        OPERATOR => '=',
+        VALUE => RT::IR->lifecycle_incident,
+    );
+
+    if ( my $first_queue = $queues->First ) {
+        $queue = $first_queue->Id;
+    }
+}
 
 my $QueueObj = RT::Queue->new($session{'CurrentUser'});
-$QueueObj->Load( $ARGS{Queue} );
+$QueueObj->Load( $queue );
 
 if (!$QueueObj->Name) {
-Abort( loc("Queue '[_1]' could not be loaded.", $ARGS{Queue}) );
+Abort( loc("Queue '[_1]' could not be loaded.", $queue) );
  }
 
 if( !RT::IR->IsIncidentQueue($QueueObj) ) {

commit db1ca1c638fe3bb2ffdf106a0b46c5a6f032f79f
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Apr 29 17:08:59 2020 -0400

    Link directly to create pages in menus
    
    Queue is now selected on the create page so the queue
    selection modal is no longer needed.

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 75211dd2..2349d71a 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -92,21 +92,21 @@ $root->child(
     path => RT::IR->HREFTo('Search/Results.html?Lifecycle='.RT::IR->lifecycle_incident, IncludeWebPath => 0)
 )->child(
     create => title => loc('Create'),
-    path => RT::IR->HREFTo('CreateInQueue.html?Lifecycle='.RT::IR->lifecycle_incident, IncludeWebPath => 0),
+    path => RT::IR->HREFTo('Incident/Create.html?Lifecycle='.RT::IR->lifecycle_incident, IncludeWebPath => 0),
 );
 $root->child(
     reports => title => loc('Incident Reports'),
     path => RT::IR->HREFTo('Search/Results.html?Lifecycle='. RT::IR->lifecycle_report, IncludeWebPath => 0)
 )->child(
     create => title => loc('Create'),
-    path => RT::IR->HREFTo('CreateInQueue.html?Lifecycle='. RT::IR->lifecycle_report, IncludeWebPath => 0),
+    path => RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_report, IncludeWebPath => 0),
 );
 $root->child(
     investigations => title => loc('Investigations'),
     path => RT::IR->HREFTo('Search/Results.html?Lifecycle='.RT::IR->lifecycle_investigation, IncludeWebPath => 0)
 )->child(
     launch => title => loc('Launch'),
-    path => RT::IR->HREFTo('CreateInQueue.html?Lifecycle='.RT::IR->lifecycle_investigation, IncludeWebPath => 0),
+    path => RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_investigation, IncludeWebPath => 0),
 );
 unless ( RT->Config->Get('RTIR_DisableCountermeasures') ) {
     $root->child(
@@ -114,7 +114,7 @@ unless ( RT->Config->Get('RTIR_DisableCountermeasures') ) {
         path => RT::IR->HREFTo('Search/Results.html?Lifecycle='.RT::IR->lifecycle_countermeasure, IncludeWebPath => 0)
     )->child(
         create => title => loc('Create'),
-        path => RT::IR->HREFTo('CreateInQueue.html?Lifecycle='.RT::IR->lifecycle_countermeasure, IncludeWebPath => 0),
+        path => RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_countermeasure, IncludeWebPath => 0),
     );
 }
 
@@ -330,8 +330,8 @@ if ( $request_path =~ m{(?:$re_rtir_path)(?:$re_rtir_types/)?(Display|Edit|Updat
     PageMenu()->child(
         new => title => loc("New [_1]", RT::IR::TicketType( Lifecycle => $lifecycle || RT::IR->lifecycle_incident ) ),
         path => !$lifecycle
-            ? RT::IR->HREFTo("CreateInQueue.html?Child=$id&Lifecycle=".RT::IR->lifecycle_incident, IncludeWebPath => 0)
-            : RT::IR->HREFTo("CreateInQueue.html?". $query_string->( Incident => $id, Lifecycle => $lifecycle ), IncludeWebPath => 0)
+            ? RT::IR->HREFTo("Incident/Create.html?Child=$id&Lifecycle=".RT::IR->lifecycle_incident, IncludeWebPath => 0)
+            : RT::IR->HREFTo('Create.html' . $query_string->( Incident => $id, Lifecycle => $lifecycle ), IncludeWebPath => 0)
         ,
     );
     PageMenu()->child(
@@ -352,7 +352,7 @@ if ( $request_path =~ m{(?:$re_rtir_path)(?:$re_rtir_types/)?(Display|Edit|Updat
 
     PageMenu()->child(
         new => title => loc("New [_1]",RT::IR::TicketType( Lifecycle => $lifecycle ) ),
-        path => RT::IR->HREFTo("CreateInQueue.html?". $query_string->( Incident => $id, Lifecycle => $lifecycle ), IncludeWebPath => 0),
+        path => RT::IR->HREFTo("Create.html?". $query_string->( Incident => $id, Lifecycle => $lifecycle ), IncludeWebPath => 0),
     );
     PageMenu()->child(
         back => title => loc('Back to [_1] #[_2]', lc RT::IR::TicketType( Lifecycle => $ticket->QueueObj->Lifecycle), $id),
@@ -542,5 +542,5 @@ PageWidgets()->child('simple_search')->raw_html( $m->scomp(
     SendTo => RT::IR->HREFTo('index.html', IncludeWebPath => 0),
     Placeholder => 'Search Incidents'
 ) );
-PageWidgets()->child( create_ticket => raw_html => $m->scomp('/RTIR/Elements/CreateTicketInQueue') );
+PageWidgets()->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('/Elements/CreateTicket', SendTo => '/RTIR/Incident/Create.html?Lifecycle='.RT::IR->lifecycle_incident) );
 </%INIT>

commit 62f0065f7398921ae1c5d64a6aa109598b2d0c25
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Apr 30 17:30:02 2020 -0400

    Update tests to find links after menu updates

diff --git a/t/002-test-reject.t b/t/002-test-reject.t
index 7fc0e932..d6d7648b 100644
--- a/t/002-test-reject.t
+++ b/t/002-test-reject.t
@@ -92,7 +92,7 @@ diag "test that after reject links to incidents are still there" if $ENV{'TEST_V
 
     # go to incident and check that we still can see the child
     $agent->display_ticket( $inc_id);
-    $agent->follow_link_ok({text => "Incident Reports"}, "Followed 'Incident Reports' link");
+    $agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
     $agent->form_number(3);
     $agent->tick( Statuses => 'rejected' );
     $agent->click('RefineStatus');
@@ -122,7 +122,7 @@ diag "test that after quick reject links to incidents are still there" if $ENV{'
 
     # go to incident and check that we still can see the child
     $agent->display_ticket( $inc_id);
-    $agent->follow_link_ok({text => "Incident Reports"}, "Followed 'Incident Reports' link");
+    $agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
     $agent->form_number(3);
     $agent->tick( Statuses => 'rejected' );
     $agent->click('RefineStatus');
@@ -141,7 +141,7 @@ diag "test that after bulk reject links to incidents are still there" if $ENV{'T
     }
 
     $agent->display_ticket( $id);
-    $agent->follow_link_ok({text => "Reports", url_regex => qr/RTIR/}, "Followed 'Incident Reports' link");
+    $agent->follow_link_ok({text => "Incident Reports", url_regex => qr/RTIR/}, "Followed 'Incident Reports' link");
     while($agent->content() !~ m{Display.html\?id=$id">$id</a>}) {
         last unless $agent->follow_link(text => 'Next');
     }
@@ -161,7 +161,7 @@ diag "test that after bulk reject links to incidents are still there" if $ENV{'T
 
     # go to incident and check that we still can see the child
     $agent->display_ticket( $inc_id);
-    $agent->follow_link_ok({text => "Incident Reports"}, "Followed 'Incident Reports' link");
+    $agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
     $agent->form_number(3);
     $agent->tick( Statuses => 'rejected' );
     $agent->click('RefineStatus');

commit d8d63ae75e92d5fcd31299a5fa831e5ce9bf558c
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 8 17:03:57 2020 -0400

    Link directly to updated create page rather than modal

diff --git a/html/Callbacks/RTIR/Elements/MakeClicky/Default b/html/Callbacks/RTIR/Elements/MakeClicky/Default
index d6fcaed3..af2560f7 100644
--- a/html/Callbacks/RTIR/Elements/MakeClicky/Default
+++ b/html/Callbacks/RTIR/Elements/MakeClicky/Default
@@ -112,7 +112,7 @@ my %actions;
                       .loc('Lookup IP') .q{</a>};
         if ( $args{incident} && !RT->Config->Get('RTIR_DisableCountermeasures') ) {
             $result .= qq{ <a class="button btn-sm btn-primary create_child_} . RT::IR->lifecycle_countermeasure . qq{" href="} .
-            RT::IR->HREFTo("CreateInQueue.html?Incident=".$args{incident}."&Lifecycle=".RT::IR->lifecycle_countermeasure.qq{&IP-Value=$escaped_host})
+            RT::IR->HREFTo("Create.html?Incident=".$args{incident}."&Lifecycle=".RT::IR->lifecycle_countermeasure.qq{&IP-Value=$escaped_host})
             .qq{">Block</a>};
         }
         if ( $args{'object'} && $args{'object'}->id ) {
@@ -162,7 +162,7 @@ my %actions;
                 $result .= qq{<input type="checkbox" name="Requestorbox-$escaped_email" unchecked />};
             }
             $result .= qq{ <a class="button btn-sm btn-primary" href="}.
-                RT::IR->HREFTo( "CreateInQueue.html"
+                RT::IR->HREFTo( "Create.html"
                 . qq{?Incident=$args{'incident'}}
                 . qq{&Lifecycle=}.RT::IR->lifecycle_investigation
                 . "&Requestors=$escaped_email")
diff --git a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
index 521f4500..5d677871 100644
--- a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
+++ b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
@@ -152,7 +152,7 @@ $COLUMN_MAP->{'LookupToolIncidentActions'} = {
             ;
         }
         push @res, \'<a href="',
-            RT::IR->HREFTo('CreateInQueue.html?Lifecycle='.RT::IR->lifecycle_investigation
+            RT::IR->HREFTo('Create.html?Lifecycle='.RT::IR->lifecycle_investigation
             .'&Incident='. $t->id),
             \('" class="create_child_' . RT::IR->lifecycle_investigation . '">'),
             '[' . $t->loc("Investigate") .']',
diff --git a/html/RTIR/Elements/ShowIncidents b/html/RTIR/Elements/ShowIncidents
index a9c58c59..2979f6b7 100644
--- a/html/RTIR/Elements/ShowIncidents
+++ b/html/RTIR/Elements/ShowIncidents
@@ -59,7 +59,7 @@
 <div class="actions">
 % unless ( $action ) {
 <a class="button btn-sm btn btn-primary" id="link-incident" href="<% RT::IR->HREFTo('Link/ToIncident/?id='. $id ) %>">Link</a>
-<a class="button btn-sm btn btn-primary" id="create-incident" href="<% RT::IR->HREFTo('CreateInQueue.html?Lifecycle=' . RT::IR->lifecycle_incident . '&Child='. $id ) %>">New</a>
+<a class="button btn-sm btn btn-primary" id="create-incident" href="<% RT::IR->HREFTo('Incident/Create.html?Lifecycle=' . RT::IR->lifecycle_incident . '&Child='. $id ) %>">New</a>
 % } elsif ( $action ne 'No' ) {
 <a class="button btn-sm btn btn-primary" href="<% RT::IR->HREFTo('Display.html?Action='. $action.'&id='. $id) %>"><% loc( $action ) %></a>
 % }
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
index 31584955..64c09765 100644
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ b/html/RTIR/Incident/Elements/ShowChildren
@@ -116,7 +116,7 @@ if ( $IncidentObj->CurrentUserHasRight('ModifyTicket') ) {
         push @box_actions, {
             title => $Lifecycle ne RT::IR->lifecycle_investigation? loc('Create') : loc('Launch'),
             class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
-            path => RT::IR->HREFTo("CreateInQueue.html?Incident=$id&Lifecycle=".$Lifecycle),
+            path => RT::IR->HREFTo("Create.html?Incident=$id&Lifecycle=".$Lifecycle),
         };
     }
     push @box_actions, {
diff --git a/html/RTIR/Tools/Elements/LookupSummary b/html/RTIR/Tools/Elements/LookupSummary
index c7495da9..91b936af 100644
--- a/html/RTIR/Tools/Elements/LookupSummary
+++ b/html/RTIR/Tools/Elements/LookupSummary
@@ -109,7 +109,7 @@ if ( $TicketObj && RT::IR->IsIncidentQueue($TicketObj->QueueObj)
         push @box_actions, {
             title => loc('Launch'),
             class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
-            path => RT::IR->HREFTo("CreateInQueue.html?". $m->comp('/Elements/QueryString',
+            path => RT::IR->HREFTo("Create.html?". $m->comp('/Elements/QueryString',
                 Incident => $TicketObj->id,
                 Lifecycle => $Lifecycle,
                 Requestors => $q,
@@ -119,7 +119,7 @@ if ( $TicketObj && RT::IR->IsIncidentQueue($TicketObj->QueueObj)
         push @box_actions, {
             title => loc('Create'),
             class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
-            path => RT::IR->HREFTo("CreateInQueue.html?". $m->comp('/Elements/QueryString',
+            path => RT::IR->HREFTo("Create.html?". $m->comp('/Elements/QueryString',
                 Incident => $TicketObj->id,
                 Lifecycle => $Lifecycle,
                 'IP-Value' => $q,
@@ -133,7 +133,7 @@ elsif ( $TicketObj && !RT::IR->IsIncidentQueue($TicketObj->QueueObj)
     push @box_actions, {
         title => loc('Create'),
         class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
-        path => RT::IR->HREFTo("CreateInQueue.html?". $m->comp('/Elements/QueryString',
+        path => RT::IR->HREFTo("Create.html?". $m->comp('/Elements/QueryString',
             Child => $TicketObj->id,
             Lifecycle => $Lifecycle
         )),

commit e8c544492ec80a654d04ea09a7b1d86b3f283b4d
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri May 8 18:35:10 2020 -0500

    Fix form name for creating tickets in tests

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 36c9e7fc..763a882d 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -405,7 +405,7 @@ sub click_through_createinqueue
     $args{fields} = { Queue => $queue } if $queue;
 
     $self->submit_form(
-        form_id => 'CreateInQueue',
+        form_id => 'CreateTicketInQueue',
         %args,
     );
 }

commit 737e6174da5fb3c6f2890c616aedbcba47e539b1
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri May 8 19:06:03 2020 -0500

    Remove unneeded method call to fix tests
    
    The additional steps performed by click_through_createinqueue are
    no longer needed since tickets are now created directly through
    the ticket create page.

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 763a882d..fb21de65 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -149,7 +149,6 @@ sub create_incident_for_ir {
     # Select the "New" link from the Display page
     $self->follow_link_ok({id => 'create-incident'}, "Followed 'New (Incident)' link")
         or Test::More::diag $self->content;
-    $self->click_through_createinqueue;
 
     $self->form_number(3);
 
diff --git a/t/020-incident-and-investigation.t b/t/020-incident-and-investigation.t
index 1e04b5d6..eabd3bf7 100755
--- a/t/020-incident-and-investigation.t
+++ b/t/020-incident-and-investigation.t
@@ -72,7 +72,6 @@ my $incident_bar = $agent->create_incident(
 $agent->display_ticket($incident_foo);
 
 $agent->follow_link_ok({text => 'Launch', n => 2}, "Followed 'Launch' link");
-$agent->click_through_createinqueue;
 $agent->form_name('TicketCreate');
 is($agent->value('Incident'), $incident_foo, 'Incident foo is checked');
 $agent->field('Incident', $incident_bar);
diff --git a/t/custom-fields/defaults-on-linking.t b/t/custom-fields/defaults-on-linking.t
index 37d12c32..5392643d 100644
--- a/t/custom-fields/defaults-on-linking.t
+++ b/t/custom-fields/defaults-on-linking.t
@@ -55,7 +55,6 @@ my $agent = default_agent();
         $agent->display_ticket( $ir_id );
         $agent->follow_link_ok({text => "New"}, "Followed 'New (Incident)' link")
             or diag $agent->content;
-        $agent->click_through_createinqueue;
         $agent->form_number(3);
 
         my $input = $agent->custom_field_input( 'Incidents', $cf_name );
diff --git a/t/incident/split.t b/t/incident/split.t
index 8e8e313f..bd1b6a53 100644
--- a/t/incident/split.t
+++ b/t/incident/split.t
@@ -26,7 +26,6 @@ my $rtir_user = rtir_user();
     ok ($new_id, "Ticket created successfully: #$new_id.");
 
     $agent->follow_link_ok({text => "Launch", n => 2 }, "Followed link");
-    $agent->click_through_createinqueue;
     $agent->form_number(3);
     $agent->field('Requestors', $rtir_user->EmailAddress);
     $agent->click('Create');

commit 3d0fbecbc12e08425d73e6e61cd300f98a0032e9
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Mon May 11 13:29:18 2020 -0500

    Fix test regex for file link names

diff --git a/t/009-attachments-processing.t b/t/009-attachments-processing.t
index c8c6796d..70e7ea24 100644
--- a/t/009-attachments-processing.t
+++ b/t/009-attachments-processing.t
@@ -33,7 +33,7 @@ $agent->goto_create_rtir_ticket('Incident Reports');
     my $attachment_link = $agent->find_link(
         tag       => 'a',
         url_regex => qr/\Q$filename/,
-        text      => '',
+        text_regex => qr/\Q$filename/,
     );
     ok($attachment_link, "has link to attachment");
 
@@ -74,7 +74,7 @@ $agent->goto_create_rtir_ticket('Incident Reports');
     my @links = $agent->find_all_links(
         tag        => 'a',
         url_regex  => qr/(?:\Q$fn1\E|\Q$fn2\E)/,
-        text       => '',
+        text_regex => qr/(?:\Q$fn1\E|\Q$fn2\E)/,
     );
     is( scalar @links, 2, "has link to two attachments");
     unlink $fn1 or die "couldn't delete file '$fn1': $!";
@@ -109,7 +109,7 @@ SKIP: {
     my $attachment_link = $agent->find_link(
         tag       => 'a',
         url_regex => qr/\Q$filename/,
-        text      => '',
+        text_regex => qr/\Q$filename/,
     );
     ok(!$attachment_link, "no link to attachment");
 
@@ -187,7 +187,7 @@ $agent->goto_create_rtir_ticket('Countermeasures');
     my $attachment_link = $agent->find_link(
         tag       => 'a',
         url_regex => qr/\Q$filename/,
-        text      => '',
+        text_regex => qr/\Q$filename/,
     );
     ok($attachment_link, "has link to attachment");
 
@@ -229,7 +229,7 @@ $agent->goto_create_rtir_ticket('Countermeasures');
         my $attachment_link = $agent->find_link(
             tag       => 'a',
             url_regex => qr/\Q$filename/,
-            text      => '',
+            text_regex => qr/\Q$filename/,
         );
         ok($attachment_link, "has link to attachment");
     }

commit 578343e7ad85b1668450c60904e3b75332d39233
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed May 13 18:54:04 2020 -0500

    Remove CreateInQueue modal element and JS
    
    RTIR is linking directly to the Create.html pages and no longer
    using the modal.

diff --git a/html/RTIR/Helpers/CreateInRTIRQueueModal b/html/RTIR/Helpers/CreateInRTIRQueueModal
deleted file mode 100644
index e8d38960..00000000
--- a/html/RTIR/Helpers/CreateInRTIRQueueModal
+++ /dev/null
@@ -1,49 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
-%#                                          <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /RTIR/Elements/CreateInRTIRQueueModal, %ARGS &>
-% $m->abort;
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 7459e6e8..415dbb4e 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -135,7 +135,6 @@ use Parse::BooleanLogic;
 my $ticket_sql_parser = Parse::BooleanLogic->new;
 
 RT->AddJavaScript('jquery.uncheckable-radio-0.1.js');
-RT->AddJavaScript('rtir.js');
 RT->AddStyleSheets( 'rtir-styles.css' );
 
 # Add the RTIR search result page to the whitelist to allow
diff --git a/static/js/rtir.js b/static/js/rtir.js
deleted file mode 100644
index 92616cb0..00000000
--- a/static/js/rtir.js
+++ /dev/null
@@ -1,75 +0,0 @@
-jQuery(function() {
-    var getQueryString = function(element) {
-        var href = jQuery(element).attr('href');
-        if (!href) return '';
-        var questionMarkIndex = href.indexOf('?');
-        if (!questionMarkIndex) return '';
-        return href.substring(questionMarkIndex+1);
-    };
-
-    var showModal = function(lifecycle, triggeringObject) {
-        var queryString = getQueryString(triggeringObject);
-        var constituency = '';
-
-        var uri = window.location.href.split('/');
-        for (var i = 0; i < uri.length; i++) {
-            if (uri[i] === 'c') {
-                constituency = '/c/' + uri[i+1];
-                break;
-            }
-        }
-
-        jQuery.get(
-            RT.Config.WebHomePath + '/RTIR' + constituency + '/Helpers/CreateInRTIRQueueModal?Lifecycle=' + lifecycle + '&' + queryString,
-            function(html) {
-                // If there's only one queue, just create a ticket in it and skip the modal
-                var queues = jQuery(html).find("select[name='Queue'] > option");
-                if (queues.length === 1) {
-                    window.location.href = RT.Config .WebHomePath + '/RTIR/Create.html?Queue=' + queues.first().val() + '&' + queryString;
-                    return;
-                }
-
-                var modal = jQuery("<div class='modal'></div>");
-                modal.append(html).appendTo("body");
-                modal.bind('modal:close', function(ev) { modal.remove(); })
-                modal.on('hide.bs.modal', function(ev) { modal.remove(); })
-                modal.modal('show');
-
-                // We need to refresh the select picker plugin on AJAX calls
-                // since the plugin only runs on page load.
-                jQuery('.selectpicker').selectpicker('refresh');
-            }
-        );
-    };
-
-    var showReportsModal = function(e) {
-        e.preventDefault();
-        showModal('incident_reports', this);
-    };
-
-    var showInvestigationsModal = function(e) {
-        e.preventDefault();
-        showModal('investigations', this);
-    };
-
-    var showCountermeasuresModal = function(e) {
-        e.preventDefault();
-        showModal('countermeasures', this);
-    };
-
-    var showIncidentsModal = function(e) {
-        e.preventDefault();
-        showModal('incidents', this);
-    };
-
-    jQuery('body').on('click', '#reports-create', showReportsModal);
-    jQuery('body').on('click', '#investigations-launch', showInvestigationsModal);
-    jQuery('body').on('click', '#countermeasures-create', showCountermeasuresModal);
-    jQuery('body').on('click', '#incidents-create', showIncidentsModal);
-    jQuery('body').on('click', '#create-incident', showIncidentsModal);
-
-    jQuery('body').on('click', '.create_child_incidents', showIncidentsModal);
-    jQuery('body').on('click', '.create_child_incident_reports', showReportsModal);
-    jQuery('body').on('click', '.create_child_investigations', showInvestigationsModal);
-    jQuery('body').on('click', '.create_child_countermeasures', showCountermeasuresModal);
-});

commit 92ae79de1d495951ca7f8ffac8703081ca0c101e
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed May 13 18:58:03 2020 -0500

    Add deprecated warning to CreateInQueue.html
    
    For users linking directly to CreateInQueue.html a deprecated
    warning and entry to UPGRADING-5.0 has been added with instructions
    to switch to the Create.html pages.

diff --git a/docs/UPGRADING-5.0 b/docs/UPGRADING-5.0
index e4e5d081..6d16f9cb 100644
--- a/docs/UPGRADING-5.0
+++ b/docs/UPGRADING-5.0
@@ -17,6 +17,18 @@ to add for each queue. This change made it harder to access the
 default RT menus, so we have reverted to the previous configuration
 with a single RTIR menu item containing relevant links.
 
+=item *
+
+To align with RT's create pages we removed the modal to select queue
+before the create page and now give users the option to select
+queue directly on create. CreateInQueue.html still remains available
+incase users are linking directly to it but now logs a deprecated
+warning when accessed.
+
+CreateInQueue.html will be removed in a future version of RTIR.
+Please update any links directly accessing CreateInQueue.html to
+instead link to RTIR/Create.html or RTIR/Incident/RTIR/Create.html.
+
 =back
 
 =cut
diff --git a/html/RTIR/CreateInQueue.html b/html/RTIR/CreateInQueue.html
index 77571253..08b6dd8a 100644
--- a/html/RTIR/CreateInQueue.html
+++ b/html/RTIR/CreateInQueue.html
@@ -53,6 +53,7 @@
 <& /RTIR/Elements/CreateInRTIRQueue, %ARGS &>
 
 <%INIT>
+RT->Logger->warning( "CreateInQueue.html has been deprecated. See RTIR's docs/UPGRADING-5.0 for more information." );
 $ARGS{ticket_type} = RT::IR::TicketType( Lifecycle => $Lifecycle );
 my $title = "Select Queue for New $ARGS{ticket_type}";
 </%INIT>

commit 1eca5131446fa486367d7e6bb404c993b2e8aec5
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed May 13 19:08:17 2020 -0500

    Fix default queue on create pages
    
    If the Queue arg is not defined, RT's GetDefaultQueue sub returns
    a queue not correctly scoped to the current user which leads to an
    Abort for unable to load queue.
    
    This commit modifies the Create.html pages to get a default queue
    limited to the Lifecycle arg or RTIR Lifecycles for the current
    user.

diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 19e246d8..08f62803 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -108,8 +108,11 @@
             args => {
                 Name           => 'Queue',
                 Default        => $Queue,
+                Lifecycle      => $Lifecycle,
                 ShowNullOption => 0,
                 AutoSubmit     => 1,
+                LimitToConstituency => $limit_to_constituency,
+                Constituency => $constituency,
             },
         },
         {
@@ -392,28 +395,19 @@
 # Make sure even a single checkbox value becomes an arrayref
 $ARGS{'SkipNotification'} = \@SkipNotification;
 
-# XXX TODO remove this code that maps lifecycles to queues
-if ($Lifecycle && ! $Queue) {
-    $Queue=ucfirst($Lifecycle);
-    $Queue=~ s/_r/ R/;
-    $ARGS{'Queue'} = $Queue;
-}
-
 my $constituency = $m->{'RTIR_ConstituencyFilter'};
 
-
 my %CFDefaults;
 $m->callback(
     CallbackName => 'Init', CallbackPage => '/Ticket/Create.html',
     ARGSRef => \%ARGS,
 );
 
-# Use default queue from config site or user prefs if none provided
-unless ($Queue) {
-    $Queue = GetDefaultQueue();
-}
-
-# pick first in list in normal order unless queue provided from form/url/defaults
+# If the Queue is not passed in as an ARG go get and set the default queue from the queues the user can CreateTicket.
+# For constituency users without access to the default RTIR queues we need to specifically check and limit else we
+# Abort below when we attempt to load the default queue as the user.
+# For creating tickets through the main navigation links, no Queue ARG is passed because we don't come from a context
+# where it would be known.
 unless ($Queue) {
     my $cache_key = SetObjectSessionCache(
         ObjectType       => 'Queue',
@@ -424,7 +418,35 @@ unless ($Queue) {
     $Queue = $session{$cache_key}{objects}[0]->{Id};
 }
 
-$session{DefaultQueue} = $Queue;
+unless ($Queue) {
+    my $collection = RT::Queues->new($session{'CurrentUser'});
+
+    # RT::Queues::AddRecord verifies the user has 'SeeQueue', so we don't
+    # need to specifically test for that in the while loop below.
+    if ($Lifecycle) {
+        $collection->Limit(FIELD => 'Lifecycle', VALUE => $Lifecycle);
+    }
+    else {
+        $collection->Limit(
+            FIELD => 'Lifecycle',
+            OPERATOR => 'IN',
+            VALUE => [RT::IR->Lifecycles],
+        );
+    }
+
+    while (my $object = $collection->Next) {
+        # Ensure the user can CreateTicket in the queue.
+        if ($session{CurrentUser}->HasRight( Object => $object, Right => 'CreateTicket' )) {
+            # We only need the first one here, no need to parse them all.
+            if ($object->Id) {
+                $Queue = $object->Id;
+                last;
+            }
+        }
+    }
+}
+
+#$session{DefaultQueue} = $Queue;
 
 my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
 $QueueObj->Load( $Queue );
@@ -433,7 +455,7 @@ if (!$QueueObj->Name) {
  Abort( loc("Queue '[_1]' could not be loaded.",$Queue) );
  }
 
-if ($Queue && !$Lifecycle) {
+if ($QueueObj && !$Lifecycle) {
     $Lifecycle = $QueueObj->Lifecycle;
 }
 
@@ -496,6 +518,13 @@ foreach my $id ( grep $_, @Incident ) {
 }
 @Incident = map $_->id, @IncidentObj;
 
+my $limit_to_constituency =
+    # Limit no matter what if we have a filter
+    $constituency ||
+    # Also limit if we have a linked constituency and StrictConstituencyLinking is set
+    (RT::IR->StrictConstituencyLinking && $constituency)
+    ? 1:0;
+
 my $children_config = RT->Config->Get('RTIR_IncidentChildren')->{ $Type };
 
 if ( @Incident > 1 && !$children_config->{'Multiple'} ) {
@@ -576,14 +605,14 @@ unshift @results, loc("Creation failed:")
 
 my ($Title, $SubmitCaption);
 if ( $Split ) {
-$Title = loc("Split [_1] #[_2]: [_3]", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle), $SplitObj->id, $SplitObj->Subject);
+$Title = loc("Split [_1] #[_2]: [_3]", RT::IR::TicketType(Lifecycle => $Lifecycle), $SplitObj->id, $SplitObj->Subject);
     $SubmitCaption = loc("Split");
 } else {
 if ( RT::IR->IsInvestigationQueue($QueueObj) ) {
     $Title = loc("Launch a new investigation");
         $SubmitCaption = loc("Launch");
     } else {
-    $Title = loc("Create a new [_1]", RT::IR::TicketType(Lifecycle => $QueueObj->Lifecycle));
+    $Title = loc("Create a new [_1]", RT::IR::TicketType(Lifecycle => $Lifecycle));
         $SubmitCaption = loc("Create");
     }
 }
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 5e587e28..f0f27991 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -130,7 +130,8 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
       <&|/l&>Queue</&>:
     </div>
     <div class="value col-md-9">
-      <& /RTIR/Elements/SelectRTIRQueue, Name => "Queue", Default => $queue, AutoSubmit => 1, ShowNullOption => 0 &>
+      <& /RTIR/Elements/SelectRTIRQueue, Name => "Queue", Default => $Queue, Lifecycle => $QueueObj->Lifecycle, AutoSubmit => 1, ShowNullOption => 0,
+                                         LimitToConstituency => $limit_to_constituency, Constituency => $constituency &>
     </div>
   </div>
   <div class="form-row">
@@ -363,29 +364,47 @@ for my $related_ticket ($ChildObj, $SplitObj) {
         last;
 }
 
+my $limit_to_constituency =
+    # Limit no matter what if we have a filter
+    $constituency ||
+    # Also limit if we have a linked constituency and StrictConstituencyLinking is set
+    (RT::IR->StrictConstituencyLinking && $constituency)
+    ? 1:0;
+
+
 # Load the first Incident queue if none is provided
-my $queue = $ARGS{'Queue'};
-unless ( $queue ) {
-    my $queues = RT::Queues->new( RT->SystemUser );
+unless ( $Queue ) {
+    my $queues = RT::Queues->new($session{'CurrentUser'});
 
     $queues->Limit(
         FIELD => 'Lifecycle',
         OPERATOR => '=',
-        VALUE => RT::IR->lifecycle_incident,
+        VALUE => $Lifecycle || RT::IR->lifecycle_incident,
     );
 
-    if ( my $first_queue = $queues->First ) {
-        $queue = $first_queue->Id;
+    while (my $object = $queues->Next) {
+        # Ensure the user can CreateTicket in the queue.
+        if ($session{CurrentUser}->HasRight( Object => $object, Right => 'CreateTicket' )) {
+            # We only need the first one here, no need to parse them all.
+            if ($object->Id) {
+                $Queue = $object->Id,
+                last;
+            }
+        }
     }
 }
 
 my $QueueObj = RT::Queue->new($session{'CurrentUser'});
-$QueueObj->Load( $queue );
+$QueueObj->Load( $Queue );
 
 if (!$QueueObj->Name) {
-Abort( loc("Queue '[_1]' could not be loaded.", $queue) );
+Abort( loc("Queue '[_1]' could not be loaded.", $Queue) );
  }
 
+if ($QueueObj && !$Lifecycle) {
+    $Lifecycle = $QueueObj->Lifecycle;
+}
+
 if( !RT::IR->IsIncidentQueue($QueueObj) ) {
     RT::Interface::Web::Redirect(RT::IR->HREFTo( '/Create.html?' . $m->comp('/Elements/QueryString', %ARGS )));
 }
@@ -497,4 +516,6 @@ $CreateIncident          => 0
 $Split                   => undef
 
 $Child                   => undef
+$Lifecycle               => undef
+$Queue                   => undef
 </%ARGS>

commit a3660775003ad10f6e7db3b2c651864b92c93063
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed May 13 19:33:23 2020 -0500

    Update test library to create tickets directly
    
    This commit updates the test library to create tickets through
    the Create.html pages instead of the deprecated CreateInQueue.html.

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index fb21de65..21e588f4 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -86,8 +86,7 @@ sub goto_create_rtir_ticket {
         warn "Failed to load queue: $queue";
     }
 
-    $self->get_ok("/RTIR/CreateInQueue.html?Lifecycle=$lifecycle");
-    $self->click_through_createinqueue( $queue );
+    $self->get_ok("/RTIR/" . ($lifecycle eq 'incidents' ? 'Incident/' : '') . "Create.html?Lifecycle=$lifecycle&Queue=" . $queue_obj->id);
 
     # set the form
     return $self->form_number(3);
@@ -394,19 +393,4 @@ sub bulk_abandon {
     return;
 }
 
-
-sub click_through_createinqueue
-{
-    my $self = shift;
-    my $queue = shift || undef;
-
-    my %args;
-    $args{fields} = { Queue => $queue } if $queue;
-
-    $self->submit_form(
-        form_id => 'CreateTicketInQueue',
-        %args,
-    );
-}
-
 1;

commit 15bb25c98cfb1bf12ee547ad6d44c4c93a80ae60
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Wed May 13 19:45:01 2020 -0500

    Update test for modal removal
    
    The functionality tested in modal.t is still valueable, although
    not correctly named since removing the create in queue modal. This
    commit renames the test as well as updates the tests to verify the
    queue select options on the Create pages instead.
    
    Additionally, the regexs within the tests were slightly loosened to
    more easily allow for pre-selected options in the dropdown.

diff --git a/t/constituency/modal.t b/t/constituency/modal.t
deleted file mode 100644
index 43852f05..00000000
--- a/t/constituency/modal.t
+++ /dev/null
@@ -1,164 +0,0 @@
-use strict;
-use warnings;
-
-use RT::IR::Test tests => undef;
-
-use_ok('RT::IR');
-
-my ($baseurl) = RT::Test->started_ok;
-my $m = default_agent();
-my $rtir_user = RT::CurrentUser->new( rtir_user() );
-my ($ok, $msg);
-
-diag "create constituencies EDUNET and GOVNET" if $ENV{'TEST_VERBOSE'};
-{
-    for my $constituency_name ( qw(EDUNET GOVNET) ) {
-        my $manager = RT::IR::ConstituencyManager->new(Constituency => $constituency_name);
-        ok($manager->AddConstituency, "added constituency $constituency_name");
-    }
-}
-
-my $eduhandler = RT::Test->load_or_create_user( Name => 'eduhandler', Password => 'eduhandler' );
-ok $eduhandler->id, "Created eduhandler";
-
-my $govhandler = RT::Test->load_or_create_user( Name => 'govhandler', Password => 'govhandler' );
-ok $govhandler->id, "Created govhandler";
-
-my $edugroup = RT::Group->new( RT->SystemUser );
-$edugroup->LoadUserDefinedGroup('DutyTeam EDUNET');
-$edugroup->AddMember( $eduhandler->PrincipalId );
-$edugroup->AddMember( $rtir_user->PrincipalId );
-
-my $govgroup = RT::Group->new( RT->SystemUser );
-$govgroup->LoadUserDefinedGroup('DutyTeam GOVNET');
-$govgroup->AddMember( $govhandler->PrincipalId );
-$govgroup->AddMember( $rtir_user->PrincipalId );
-
-diag "check queue visibility in modal" if $ENV{'TEST_VERBOSE'};
-{
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incident_reports");
-    $m->content_like(qr{<option value="\d+">Incident Reports</option>}, 'Queue dropdown has standard incident reports queue');
-    $m->content_like(qr{<option value="\d+">Incident Reports - EDUNET</option>}, 'Queue dropdown has EDUNET incident reports queue');
-    $m->content_like(qr{<option value="\d+">Incident Reports - GOVNET</option>}, 'Queue dropdown has GOVNET incident reports queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incidents");
-    $m->content_like(qr{<option value="\d+">Incidents</option>}, 'Queue dropdown has standard incidents queue');
-    $m->content_like(qr{<option value="\d+">Incidents - EDUNET</option>}, 'Queue dropdown has EDUNET incidents queue');
-    $m->content_like(qr{<option value="\d+">Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=investigations");
-    $m->content_like(qr{<option value="\d+">Investigations</option>}, 'Queue dropdown has standard investigations queue');
-    $m->content_like(qr{<option value="\d+">Investigations - EDUNET</option>}, 'Queue dropdown has EDUNET investigations queue');
-    $m->content_like(qr{<option value="\d+">Investigations - GOVNET</option>}, 'Queue dropdown has GOVNET investigations queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=countermeasures");
-    $m->content_like(qr{<option value="\d+">Countermeasures</option>}, 'Queue dropdown has standard countermeasures queue');
-    $m->content_like(qr{<option value="\d+">Countermeasures - EDUNET</option>}, 'Queue dropdown has EDUNET countermeasures queue');
-    $m->content_like(qr{<option value="\d+">Countermeasures - GOVNET</option>}, 'Queue dropdown has GOVNET countermeasures queue');
-}
-
-diag "check queue visibility in modal when created from incident" if $ENV{'TEST_VERBOSE'};
-{
-    my $i = RT::Ticket->new( $rtir_user );
-    ($ok, $msg) = $i->Create(
-        Subject => 'test incident',
-        Queue => 'Incidents - GOVNET',
-    );
-    ok($ok, 'created test incident');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incident_reports&Incident=".$i->id);
-    $m->content_like(qr{<option value="\d+">Incident Reports - GOVNET</option>}, 'Queue dropdown has GOVNET incident reports queue');
-    $m->content_unlike(qr{<option value="\d+">Incident Reports</option>}, 'Queue dropdown doesn\'t have standard incident reports queue');
-    $m->content_unlike(qr{<option value="\d+">Incident Reports - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incident reports queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=investigations&Incident=".$i->id);
-    $m->content_like(qr{<option value="\d+">Investigations - GOVNET</option>}, 'Queue dropdown has GOVNET investigations queue');
-    $m->content_unlike(qr{<option value="\d+">Investigations</option>}, 'Queue dropdown doesn\'t have standard investigations queue');
-    $m->content_unlike(qr{<option value="\d+">Investigations - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET investigations queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=countermeasures&Incident=".$i->id);
-    $m->content_like(qr{<option value="\d+">Countermeasures - GOVNET</option>}, 'Queue dropdown has GOVNET countermeasures queue');
-    $m->content_unlike(qr{<option value="\d+">Countermeasures</option>}, 'Queue dropdown doesn\'t have standard countermeasures queue');
-    $m->content_unlike(qr{<option value="\d+">Countermeasures - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET countermeasures queue');
-}
-
-diag "check queue visibility in modal when created from incident report" if $ENV{'TEST_VERBOSE'};
-{
-    my $r = RT::Ticket->new( $rtir_user );
-    ($ok, $msg) = $r->Create(
-        Subject => 'test incident report',
-        Queue => 'Incident Reports - GOVNET',
-    );
-    ok($ok, 'created test incident report');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incidents&Child=".$r->id);
-    $m->content_like(qr{<option value="\d+">Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incidents queue');
-}
-
-diag "check queue visibility in modal when filtering constituency" if $ENV{'TEST_VERBOSE'};
-{
-    $m->get("$baseurl/RTIR/c/GOVNET/Helpers/CreateInRTIRQueueModal?Lifecycle=incidents");
-    $m->content_like(qr{<option value="\d+">Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
-
-    $m->get("$baseurl/RTIR/c/EDUNET/Helpers/CreateInRTIRQueueModal?Lifecycle=incidents");
-    $m->content_like(qr{<option value="\d+">Incidents - EDUNET</option>}, 'Queue dropdown has EDUNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET incidents queue');
-}
-
-diag "check queue visibility in modal - eduhandler" if $ENV{'TEST_VERBOSE'};
-{
-    $m->login('eduhandler', 'eduhandler', logout => 1);
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incident_reports");
-    $m->content_like(qr{<option value="\d+">Incident Reports - EDUNET</option>}, 'Queue dropdown has EDUNET incident reports queue');
-    $m->content_unlike(qr{<option value="\d+">Incident Reports</option>}, 'Queue dropdown doesn\'t have standard incident reports queue');
-    $m->content_unlike(qr{<option value="\d+">Incident Reports - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET incident reports queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incidents");
-    $m->content_like(qr{<option value="\d+">Incidents - EDUNET</option>}, 'Queue dropdown has EDUNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET incidents queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=investigations");
-    $m->content_like(qr{<option value="\d+">Investigations - EDUNET</option>}, 'Queue dropdown has EDUNET investigations queue');
-    $m->content_unlike(qr{<option value="\d+">Investigations</option>}, 'Queue dropdown doesn\'t have standard investigations queue');
-    $m->content_unlike(qr{<option value="\d+">Investigations - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET investigations queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=countermeasures");
-    $m->content_like(qr{<option value="\d+">Countermeasures - EDUNET</option>}, 'Queue dropdown has EDUNET countermeasures queue');
-    $m->content_unlike(qr{<option value="\d+">Countermeasures</option>}, 'Queue dropdown doesn\'t have standard countermeasures queue');
-    $m->content_unlike(qr{<option value="\d+">Countermeasures - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET countermeasures queue');
-}
-
-diag "check queue visibility in modal - govhandler" if $ENV{'TEST_VERBOSE'};
-{
-    $m->login('govhandler', 'govhandler', logout => 1);
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incident_reports");
-    $m->content_like(qr{<option value="\d+">Incident Reports - GOVNET</option>}, 'Queue dropdown has GOVNET incident reports queue');
-    $m->content_unlike(qr{<option value="\d+">Incident Reports - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incident reports queue');
-    $m->content_unlike(qr{<option value="\d+">Incident Reports</option>}, 'Queue dropdown doesn\'t have standard incident reports queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=incidents");
-    $m->content_like(qr{<option value="\d+">Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incidents queue');
-    $m->content_unlike(qr{<option value="\d+">Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=investigations");
-    $m->content_like(qr{<option value="\d+">Investigations - GOVNET</option>}, 'Queue dropdown has GOVNET investigations queue');
-    $m->content_unlike(qr{<option value="\d+">Investigations - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET investigations queue');
-    $m->content_unlike(qr{<option value="\d+">Investigations</option>}, 'Queue dropdown doesn\'t have standard investigations queue');
-
-    $m->get("$baseurl/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=countermeasures");
-    $m->content_like(qr{<option value="\d+">Countermeasures - GOVNET</option>}, 'Queue dropdown has GOVNET countermeasures queue');
-    $m->content_unlike(qr{<option value="\d+">Countermeasures - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET countermeasures queue');
-    $m->content_unlike(qr{<option value="\d+">Countermeasures</option>}, 'Queue dropdown doesn\'t have standard countermeasures queue');
-}
-
-undef $m;
-done_testing;
diff --git a/t/constituency/queue_select.t b/t/constituency/queue_select.t
new file mode 100644
index 00000000..9d567dfe
--- /dev/null
+++ b/t/constituency/queue_select.t
@@ -0,0 +1,154 @@
+use strict;
+use warnings;
+
+use RT::IR::Test tests => undef;
+
+use_ok('RT::IR');
+
+my ($baseurl) = RT::Test->started_ok;
+my $m = default_agent();
+my $rtir_user = RT::CurrentUser->new( rtir_user() );
+my ($ok, $msg);
+
+diag "create constituencies EDUNET and GOVNET" if $ENV{'TEST_VERBOSE'};
+{
+    for my $constituency_name ( qw(EDUNET GOVNET) ) {
+        my $manager = RT::IR::ConstituencyManager->new(Constituency => $constituency_name);
+        ok($manager->AddConstituency, "added constituency $constituency_name");
+    }
+}
+
+my $eduhandler = RT::Test->load_or_create_user( Name => 'eduhandler', Password => 'eduhandler' );
+ok $eduhandler->id, "Created eduhandler";
+
+my $govhandler = RT::Test->load_or_create_user( Name => 'govhandler', Password => 'govhandler' );
+ok $govhandler->id, "Created govhandler";
+
+my $edugroup = RT::Group->new( RT->SystemUser );
+$edugroup->LoadUserDefinedGroup('DutyTeam EDUNET');
+$edugroup->AddMember( $eduhandler->PrincipalId );
+$edugroup->AddMember( $rtir_user->PrincipalId );
+
+my $govgroup = RT::Group->new( RT->SystemUser );
+$govgroup->LoadUserDefinedGroup('DutyTeam GOVNET');
+$govgroup->AddMember( $govhandler->PrincipalId );
+$govgroup->AddMember( $rtir_user->PrincipalId );
+
+diag "check queue visibility" if $ENV{'TEST_VERBOSE'};
+{
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=incident_reports");
+    $m->content_like(qr{Incident Reports</option>}, 'Queue dropdown has standard incident reports queue');
+    $m->content_like(qr{Incident Reports - EDUNET</option>}, 'Queue dropdown has EDUNET incident reports queue');
+    $m->content_like(qr{Incident Reports - GOVNET</option>}, 'Queue dropdown has GOVNET incident reports queue');
+
+    $m->get("$baseurl/RTIR/Incident/Create.html?Lifecycle=incidents");
+    $m->content_like(qr{Incidents</option>}, 'Queue dropdown has standard incidents queue');
+    $m->content_like(qr{Incidents - EDUNET</option>}, 'Queue dropdown has EDUNET incidents queue');
+    $m->content_like(qr{Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=investigations");
+    $m->content_like(qr{Investigations</option>}, 'Queue dropdown has standard investigations queue');
+    $m->content_like(qr{Investigations - EDUNET</option>}, 'Queue dropdown has EDUNET investigations queue');
+    $m->content_like(qr{Investigations - GOVNET</option>}, 'Queue dropdown has GOVNET investigations queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=countermeasures");
+    $m->content_like(qr{Countermeasures</option>}, 'Queue dropdown has standard countermeasures queue');
+    $m->content_like(qr{Countermeasures - EDUNET</option>}, 'Queue dropdown has EDUNET countermeasures queue');
+    $m->content_like(qr{Countermeasures - GOVNET</option>}, 'Queue dropdown has GOVNET countermeasures queue');
+}
+
+diag "check queue visibility when created from incident" if $ENV{'TEST_VERBOSE'};
+{
+    my $id = $m->create_rtir_ticket_ok( 'Incidents - GOVNET', { Subject => 'test incident' } );
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=incident_reports&Incident=$id");
+    $m->content_like(qr{Incident Reports - GOVNET</option>}, 'Queue dropdown has GOVNET incident reports queue');
+    $m->content_unlike(qr{Incident Reports</option>}, 'Queue dropdown doesn\'t have standard incident reports queue');
+    $m->content_unlike(qr{Incident Reports - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incident reports queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=investigations&Incident=$id");
+    $m->content_like(qr{Investigations - GOVNET</option>}, 'Queue dropdown has GOVNET investigations queue');
+    $m->content_unlike(qr{Investigations</option>}, 'Queue dropdown doesn\'t have standard investigations queue');
+    $m->content_unlike(qr{Investigations - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET investigations queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=countermeasures&Incident=$id");
+    $m->content_like(qr{Countermeasures - GOVNET</option>}, 'Queue dropdown has GOVNET countermeasures queue');
+    $m->content_unlike(qr{Countermeasures</option>}, 'Queue dropdown doesn\'t have standard countermeasures queue');
+    $m->content_unlike(qr{Countermeasures - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET countermeasures queue');
+}
+
+diag "check queue visibility when created from incident report" if $ENV{'TEST_VERBOSE'};
+{
+    my $id = $m->create_rtir_ticket_ok( 'Incident Reports - GOVNET', { Subject => 'test incident report' } );
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=incidents&Child=$id");
+    $m->content_like(qr{Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
+    $m->content_unlike(qr{Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
+    $m->content_unlike(qr{Incidents - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incidents queue');
+}
+
+diag "check queue visibility when filtering constituency" if $ENV{'TEST_VERBOSE'};
+{
+    $m->get("$baseurl/RTIR/c/GOVNET/Create.html?Lifecycle=incidents");
+    $m->content_like(qr{Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
+    $m->content_unlike(qr{Incidents - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incidents queue');
+    $m->content_unlike(qr{Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
+
+    $m->get("$baseurl/RTIR/c/EDUNET/Create.html?Lifecycle=incidents");
+    $m->content_like(qr{Incidents - EDUNET</option>}, 'Queue dropdown has EDUNET incidents queue');
+    $m->content_unlike(qr{Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
+    $m->content_unlike(qr{Incidents - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET incidents queue');
+}
+
+diag "check queue visibility - eduhandler" if $ENV{'TEST_VERBOSE'};
+{
+    $m->login('eduhandler', 'eduhandler', logout => 1);
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=incident_reports");
+    $m->content_like(qr{Incident Reports - EDUNET</option>}, 'Queue dropdown has EDUNET incident reports queue');
+    $m->content_unlike(qr{Incident Reports</option>}, 'Queue dropdown doesn\'t have standard incident reports queue');
+    $m->content_unlike(qr{Incident Reports - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET incident reports queue');
+
+    $m->get("$baseurl/RTIR/Incident/Create.html?Lifecycle=incidents");
+    $m->content_like(qr{Incidents - EDUNET</option>}, 'Queue dropdown has EDUNET incidents queue');
+    $m->content_unlike(qr{Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
+    $m->content_unlike(qr{Incidents - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET incidents queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=investigations");
+    $m->content_like(qr{Investigations - EDUNET</option>}, 'Queue dropdown has EDUNET investigations queue');
+    $m->content_unlike(qr{Investigations</option>}, 'Queue dropdown doesn\'t have standard investigations queue');
+    $m->content_unlike(qr{Investigations - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET investigations queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=countermeasures");
+    $m->content_like(qr{Countermeasures - EDUNET</option>}, 'Queue dropdown has EDUNET countermeasures queue');
+    $m->content_unlike(qr{Countermeasures</option>}, 'Queue dropdown doesn\'t have standard countermeasures queue');
+    $m->content_unlike(qr{Countermeasures - GOVNET</option>}, 'Queue dropdown doesn\'t have GOVNET countermeasures queue');
+}
+
+diag "check queue visibility - govhandler" if $ENV{'TEST_VERBOSE'};
+{
+    $m->login('govhandler', 'govhandler', logout => 1);
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=incident_reports");
+    $m->content_like(qr{Incident Reports - GOVNET</option>}, 'Queue dropdown has GOVNET incident reports queue');
+    $m->content_unlike(qr{Incident Reports - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incident reports queue');
+    $m->content_unlike(qr{Incident Reports</option>}, 'Queue dropdown doesn\'t have standard incident reports queue');
+
+    $m->get("$baseurl/RTIR/Incident/Create.html?Lifecycle=incidents");
+    $m->content_like(qr{Incidents - GOVNET</option>}, 'Queue dropdown has GOVNET incidents queue');
+    $m->content_unlike(qr{Incidents - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET incidents queue');
+    $m->content_unlike(qr{Incidents</option>}, 'Queue dropdown doesn\'t have standard incidents queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=investigations");
+    $m->content_like(qr{Investigations - GOVNET</option>}, 'Queue dropdown has GOVNET investigations queue');
+    $m->content_unlike(qr{Investigations - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET investigations queue');
+    $m->content_unlike(qr{Investigations</option>}, 'Queue dropdown doesn\'t have standard investigations queue');
+
+    $m->get("$baseurl/RTIR/Create.html?Lifecycle=countermeasures");
+    $m->content_like(qr{Countermeasures - GOVNET</option>}, 'Queue dropdown has GOVNET countermeasures queue');
+    $m->content_unlike(qr{Countermeasures - EDUNET</option>}, 'Queue dropdown doesn\'t have EDUNET countermeasures queue');
+    $m->content_unlike(qr{Countermeasures</option>}, 'Queue dropdown doesn\'t have standard countermeasures queue');
+}
+
+undef $m;
+done_testing;

-----------------------------------------------------------------------


More information about the rt-commit mailing list