[Rt-commit] rt branch, 5.0/hide-pencil-button-if-no-rights, created. rt-5.0.0alpha1-32-gf38f8a1f27

Michel Rodriguez michel at bestpractical.com
Mon Mar 23 08:40:47 EDT 2020


The branch, 5.0/hide-pencil-button-if-no-rights has been created
        at  f38f8a1f27a5825955bea5f3f3d489a57e6e9ec3 (commit)

- Log -----------------------------------------------------------------
commit 53b41199560667c1e5562f42f31bb303a7ea5179
Author: michel <michel at bestpractical.com>
Date:   Fri Mar 20 19:41:10 2020 +0100

    Bug fix: use the right CurrentUserCanSetOwner return value.
    
    CurrentUserCanSetOwner returns ($ok, $msg), not a boolean.

diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 0c5ffdab9b..be0c44801f 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -226,7 +226,7 @@ $InlineEdit => 0
 <%INIT>
 my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
 my $can_modify_cf = $Ticket->CurrentUserHasRight('ModifyCustomField');
-my $can_modify_owner = $Ticket->CurrentUserCanSetOwner();
+my( $can_modify_owner) = $Ticket->CurrentUserCanSetOwner();
 my $can_modify_people = $Ticket->CurrentUserHasRight('Watch')
                      || $Ticket->CurrentUserHasRight('WatchAsAdminCc');
 

commit f38f8a1f27a5825955bea5f3f3d489a57e6e9ec3
Author: michel <michel at bestpractical.com>
Date:   Fri Mar 20 20:14:41 2020 +0100

    Hide the pencil icon if the user doesn't have the rights.
    
    On the ticket display page, only display the pencil icon if the
    user can modify data in the portlet.

diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index be0c44801f..5bc47b6bf4 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -64,7 +64,7 @@ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_ed
 
     <&| /Widgets/TitleBox, title => loc('The Basics'),
         (($can_modify || $can_modify_cf) ? (title_href => $modify_url) : ()),
-        ($modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_basics) : ()),
+        (($can_modify || $can_modify_cf) && $modify_behavior =~ /^(link|click)$/ ? ( titleright_raw => $modify_basics ) : ()),
         class => (join " ", 'ticket-info-basics', ($modify_behavior eq 'always' ? 'editing' : ())),
         data => { 'inline-edit-behavior' => $modify_behavior },
     &>
@@ -95,7 +95,7 @@ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_ed
 
 <%PERL>
 my $people_url = RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id;
-my $people_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $people_url, 'h' ) );
+my $people_inline = $can_modify_people ? sprintf( $modify_inline, $m->interp->apply_escapes( $people_url, 'h' ) ) : '';
 my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link') : 'hide';
 </%PERL>
     <&| /Widgets/TitleBox, title => loc('People'),
@@ -144,7 +144,7 @@ my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_ed
 
 <%PERL>
 my $dates_url = RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id;
-my $dates_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
+my $dates_inline = $can_modify ? sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) ) : '';
 my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link') : 'hide';
 </%PERL>
     <&| /Widgets/TitleBox, title => loc("Dates"),
@@ -174,7 +174,7 @@ my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit
 <& /Ticket/Elements/ShowAssets, Ticket => $Ticket &>
 <%PERL>
 my $links_url = RT->Config->Get('WebPath')."/Ticket/ModifyLinks.html?id=".$Ticket->Id;
-my $links_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $links_url, 'h' ) );
+my $links_inline = $can_modify ? sprintf( $modify_inline, $m->interp->apply_escapes( $links_url, 'h' ) ) : '';
 my $links_behavior = $InlineEdit ? ($inline_edit_behavior{Links} || $inline_edit_behavior{_default} || 'link') : 'hide';
 my $alt = loc('Graph ticket links');
 my $links_graph = '<a href="' . RT->Config->Get('WebPath') . '/Ticket/Graphs/index.html?id=' . $Ticket->id . '"><span class="fas fa-project-diagram icon-bordered fa-2x" alt="' . $alt . '" data-toggle="tooltip" data-placement="top" data-original-title="' . $alt . '"></span></a>';

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


More information about the rt-commit mailing list