[Rt-commit] rt branch 5.0/validate-get-default-queue created. rt-5.0.2-25-gef9baaa4f8

BPS Git Server git at git.bestpractical.com
Mon Nov 1 20:27:24 UTC 2021

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/validate-get-default-queue has been created
        at  ef9baaa4f813c58d34fe3a21c0012463975c891d (commit)

- Log -----------------------------------------------------------------
commit ef9baaa4f813c58d34fe3a21c0012463975c891d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 2 03:35:12 2021 +0800

    Load queue object in GetDefaultQueue to make sure it's valid and visible
    This is an edge case. Previously if current user did't have "SeeQueue"
    on the default queue, clicking "Create new ticket" would redirect to
    ticket create page with the default queue id filled, which is weird
    especially if current user has "SeeQueue" on another queue(it makes more
    sense to use this queue instead).
    As we don't fill the unavailable default queue any more, now ticket
    create page can fill the first available queue instead.
    To be consistent with documentation, now it always returns ID if found.
    Previously it could be NAME if config is set to a name like "General".

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index ce0931f35a..6f85fcec03 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -4800,7 +4800,9 @@ sub GetDefaultQueue {
         $queue = RT->Config->Get( "DefaultQueue", $session{'CurrentUser'} );
-    return $queue;
+    my $obj = RT::Queue->new( $HTML::Mason::Commands::session{'CurrentUser'} );
+    $obj->Load($queue);
+    return defined $obj->Name ? $obj->Id : undef;
 =head2 UpdateDashboard



More information about the rt-commit mailing list