[Rt-commit] rt branch, 5.0/hide-pencil-button-if-no-rights, repushed

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


The branch 5.0/hide-pencil-button-if-no-rights was deleted and repushed:
       was 935e5c01ec3678fd16032b2b48dc70e36967bda0
       now f38f8a1f27a5825955bea5f3f3d489a57e6e9ec3

-:  ------- > 1: 53b4119956 Bug fix: use the right CurrentUserCanSetOwner return value.
1: 05b82dbe42 ! 2: f38f8a1f27 Hide the pencil icon if the user doesn't have the rights.
    @@ -2,39 +2,22 @@
     
         Hide the pencil icon if the user doesn't have the rights.
         
    -    On the ticket display page.
    -    
    -    I restructured the variables that determine whether each portlet should
    -    show the icon and link the title to the edit form so the 2 features
    -    can share them without duplicating the tests on the conditions.
    +    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
     --- a/share/html/Ticket/Elements/ShowSummary
     +++ b/share/html/Ticket/Elements/ShowSummary
     @@
    -     . '<a class="inline-edit-toggle cancel hidden" href="#">'
    -     . qq{<span class="fas fa-times icon-bordered fa-2x" alt="$cancel_label" data-toggle="tooltip" data-placement="top" data-original-title="$cancel_label"></span>}
    -     . '</a>';
    --my $modify_basics = sprintf( $modify_inline, $m->interp->apply_escapes( $modify_url, 'h' ) );
    -+my $modify_basics = $can_modify ? sprintf( $modify_inline, $m->interp->apply_escapes( $modify_url, 'h' ) ) : '';
    - my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link') : 'hide';
    - </%PERL>
      
          <&| /Widgets/TitleBox, title => loc('The Basics'),
    --        (($can_modify || $can_modify_cf) ? (title_href => $modify_url) : ()),
    -+        ($can_modify_basics ? (title_href => $modify_url) : ()),
    -         ($modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_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 },
    +     &>
     @@
    - % $m->callback( %ARGS, CallbackName => 'AfterBasics' );
    -     <& /Elements/ShowCustomFieldCustomGroupings,
    -         Object       => $Ticket,
    --        title_href   => ($can_modify || $can_modify_cf) ? RT->Config->Get('WebPath')."/Ticket/Modify.html" : "",
    --        InlineEdit   => $InlineEdit,
    -+        title_href   => $can_modify_basics ? RT->Config->Get('WebPath')."/Ticket/Modify.html" : "",
    -+        InlineEdit   => ( $can_modify_cf && $InlineEdit ),
    -         &>
      
      <%PERL>
      my $people_url = RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id;
    @@ -43,11 +26,6 @@
      my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link') : 'hide';
      </%PERL>
          <&| /Widgets/TitleBox, title => loc('People'),
    --        (($can_modify || $can_modify_owner || $can_modify_people) ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id) : ()),
    -+        ($can_modify_people ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id) : ()),
    -         class => (join " ", 'ticket-info-people', ($people_behavior eq 'always' ? 'editing' : ())),
    -         ($people_behavior =~ /^(link|click)$/ ? (titleright_raw => $people_inline) : ()),
    -         data => { 'inline-edit-behavior' => $people_behavior },
     @@
      
      <%PERL>
    @@ -66,16 +44,3 @@
      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>';
    -@@
    - <%INIT>
    - my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
    - my $can_modify_cf = $Ticket->CurrentUserHasRight('ModifyCustomField');
    --my $can_modify_owner = $Ticket->CurrentUserCanSetOwner();
    --my $can_modify_people = $Ticket->CurrentUserHasRight('Watch')
    -+my $can_modify_basics = $can_modify || $can_modify_cf;
    -+my $can_modify_people = $Ticket->CurrentUserCanSetOwner();
    -+                     || $Ticket->CurrentUserHasRight('Watch')
    -                      || $Ticket->CurrentUserHasRight('WatchAsAdminCc');
    - 
    - my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
    -
2: 935e5c01ec < -:  ------- Fix a bug in determining whether the user can edit the people info.



More information about the rt-commit mailing list