Skip to content

Commit

Permalink
Merge branch '4.4-trunk' into 5.0-trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnavy committed Aug 16, 2023
2 parents 7e755dc + 9d8c9b8 commit 0072407
Show file tree
Hide file tree
Showing 19 changed files with 582 additions and 110 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/github-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
- name: Check out RT
uses: actions/checkout@v2
- name: Cache .prove state
Expand Down Expand Up @@ -65,6 +66,7 @@ jobs:
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
- name: Checkout RT
uses: actions/checkout@v2
- name: Cache .prove state
Expand Down Expand Up @@ -119,6 +121,7 @@ jobs:
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
- name: Checkout RT
uses: actions/checkout@v2
- name: Cache .prove state
Expand Down Expand Up @@ -172,6 +175,7 @@ jobs:
run: |
echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV
- name: Checkout RT
uses: actions/checkout@v2
- name: Cache .prove state
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ o Perl 5.10.1 or later (http://www.perl.org).

o A supported SQL database

Currently supported: MySQL 5.7 with InnoDB support
Currently supported: MySQL 5.7, 8 with InnoDB support
MariaDB 10.2 or later with InnoDB support
Postgres 9.5 or later
Oracle 12c or later
Expand Down
5 changes: 5 additions & 0 deletions docs/UPGRADING-4.4
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,11 @@ we have replaced it with the GraphViz2 module.
Systems using C<--enable-graphviz> will be prompted to install the Perl
GraphViz2 module when upgrading.

=item * MySQL 8 now supported

Starting with RT 4.4.7, RT now supports MySQL 8. Note that as part of this upgrade
you also need to update the module L<DBIx::SearchBuilder>.

=back

=cut
11 changes: 11 additions & 0 deletions docs/UPGRADING-5.0
Original file line number Diff line number Diff line change
Expand Up @@ -606,4 +606,15 @@ custom field in articles.

=back

=head1 UPGRADING FROM 5.0.4 AND EARLIER

=over 4

=item * MySQL 8 now supported

Starting with RT 5.0.5, RT now supports MySQL 8. Note that as part of this upgrade
you also need to update the module L<DBIx::SearchBuilder>.

=back

=cut
5 changes: 3 additions & 2 deletions docs/ticket_metadata.pod
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ will update itself with the opposite relationship).

=head2 Parent

Parent tickets have children tickets, all of which must be resolved before the
parent ticket can be resolved.
Parent tickets have children tickets, which perhaps were opened as a result of
investigating the parent ticket. Parent and children do not enforce a resolution
order.

How would one use this information in searches? Let's say you're using RT to
manage a release of the software your company makes. Often times release
Expand Down
24 changes: 12 additions & 12 deletions etc/RT_Config.pm.in
Original file line number Diff line number Diff line change
Expand Up @@ -3080,18 +3080,6 @@ Set($GroupSearchFields, {
Description => 'LIKE',
});

=item C<$AllowGroupAutocompleteForUnprivileged>

Defines whether unprivileged users (users of SelfService) are allowed
to autocomplete groups when searching. Setting this option to 1 means
unprivileged users will be able to search all your user created
group names. Users will also need the SeeGroup privilege to use
this feature.

=cut

Set($AllowGroupAutocompleteForUnprivileged, 0);

=back

=head2 Self Service Interface
Expand Down Expand Up @@ -3132,6 +3120,18 @@ will be able to search all your users.

Set($AllowUserAutocompleteForUnprivileged, 0);

=item C<$AllowGroupAutocompleteForUnprivileged>

Defines whether unprivileged users (users of SelfService) are allowed
to autocomplete groups for roles like Requestors or Ccs. Setting this
option to 1 enables autocomplete on user-created group names for self
service users. Users also need the SeeGroup right on each
group for them to appear in the autocomplete suggestions.

=cut

Set($AllowGroupAutocompleteForUnprivileged, 0);

=item C<$DefaultSelfServiceSearchResultFormat>

C<$DefaultSelfServiceSearchResultFormat> is the default format of
Expand Down
2 changes: 1 addition & 1 deletion lib/RT/Ticket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,7 @@ sub SeenUpTo {
}

my $txns = $self->Transactions;
$txns->Limit( FIELD => 'Type', VALUE => [ 'Comment', 'Correspond' ], OPERATOR => 'IN' );
$txns->Limit( FIELD => 'Type', VALUE => [ 'Create', 'Comment', 'Correspond' ], OPERATOR => 'IN' );
$txns->Limit( FIELD => 'Creator', OPERATOR => '!=', VALUE => $uid );
$txns->Limit(
FIELD => 'Created',
Expand Down
146 changes: 145 additions & 1 deletion lib/RT/Tickets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ our %FIELD_METADATA = (
WatcherGroup => [ 'MEMBERSHIPFIELD', ], #loc_left_pair
HasAttribute => [ 'HASATTRIBUTE', 1 ],
HasNoAttribute => [ 'HASATTRIBUTE', 0 ],
HasUnreadMessages => [ 'HASUNREADMESSAGES', 1 ],
HasNoUnreadMessages => [ 'HASUNREADMESSAGES', 0 ],
);

# Lower Case version of FIELDS, for case insensitivity
Expand Down Expand Up @@ -197,6 +199,7 @@ our %dispatch = (
CUSTOMFIELD => \&_CustomFieldLimit,
HASATTRIBUTE => \&_HasAttributeLimit,
LIFECYCLE => \&_LifecycleLimit,
HASUNREADMESSAGES => \&_HasUnreadMessagesLimit,
);

# Default EntryAggregator per type
Expand Down Expand Up @@ -1433,6 +1436,147 @@ sub _HasAttributeLimit {
);
}

sub _HasUnreadMessagesLimit {
my ( $orig_self, $field, $op, $value, %rest ) = @_;

my $self;
if ( $FIELD_METADATA{$field}->[1] ) {
$self = $orig_self;
}
else {
$self = $orig_self->Clone;
}

my $alias = $self->Join(
TYPE => 'LEFT',
ALIAS1 => 'main',
FIELD1 => 'id',
TABLE2 => 'Attributes',
FIELD2 => 'ObjectId',
);
$self->Limit(
LEFTJOIN => $alias,
FIELD => 'ObjectType',
VALUE => 'RT::Ticket',
ENTRYAGGREGATOR => 'AND',
);

my $db_type = RT->Config->Get('DatabaseType');
my $quote_value;
my $attr_name;
if ( $value =~ /\D/ ) {
if ( $value =~ /^(?:main\.)?Owner$/i ) {
if ( $db_type eq 'Pg' ) {
$attr_name = "CONCAT('User-'::text, main.Owner, '-SeenUpTo'::text)";
}
elsif ( $db_type =~ /Oracle|SQLite/ ) {
$attr_name = "'User-' || main.Owner || '-SeenUpTo'";
}
else {
$attr_name = "CONCAT('User-', main.Owner, '-SeenUpTo')";
}
$value = 'main.Owner';
$quote_value = 0;
}
else {
my $user = RT::User->new( $self->CurrentUser );
$user->Load($value);
$value = $user->Id || 0;
}
}

if ( $value =~ /^\d+$/ ) {
$attr_name = "User-$value-SeenUpTo";
$quote_value = 1;
}

$self->Limit(
LEFTJOIN => $alias,
FIELD => 'Name',
OPERATOR => $op,
VALUE => $attr_name,
QUOTEVALUE => $quote_value,
ENTRYAGGREGATOR => 'AND',
);

my $ticket_alias = $self->Join(
ALIAS1 => 'main',
FIELD1 => 'id',
TABLE2 => 'Tickets',
FIELD2 => 'EffectiveId',
);
my $txn_alias = $self->Join(
ALIAS1 => $ticket_alias,
FIELD1 => 'id',
TABLE2 => 'Transactions',
FIELD2 => 'ObjectId',
);
$self->Limit(
LEFTJOIN => $txn_alias,
FIELD => 'ObjectType',
VALUE => 'RT::Ticket',
ENTRYAGGREGATOR => 'AND',
);
$self->Limit(
LEFTJOIN => $txn_alias,
FIELD => 'Type',
VALUE => [ 'Create', 'Correspond', 'Comment' ],
OPERATOR => 'IN',
ENTRYAGGREGATOR => 'AND',
);
$self->Limit(
LEFTJOIN => $txn_alias,
FIELD => 'Creator',
VALUE => $value,
OPERATOR => '!=',
QUOTEVALUE => $quote_value,
);

my $function;
if ( $db_type eq 'Pg' ) {
$function = "CAST($txn_alias.Created AS TEXT)";
}
elsif ( $db_type eq 'Oracle' ) {
$function = "TO_CHAR($txn_alias.Created, 'YYYY-MM-DD HH24:MI:SS')";
}

$self->_OpenParen();

# Has no SeenUpTo attribute and has contents created by other people ever
$self->Limit(
%rest,
ALIAS => $alias,
FIELD => 'id',
OPERATOR => 'IS',
VALUE => 'NULL',
QUOTEVALUE => 0,
);

# Has SeenUpTo attribute and contents created by other people after that
$self->Limit(
ALIAS => $txn_alias,
FIELD => 'Created',
OPERATOR => '>',
VALUE => $db_type eq 'Oracle' ? "DBMS_LOB.substr($alias.Content, 19)" : "$alias.Content",
QUOTEVALUE => 0,
ENTRYAGGREGATOR => 'OR',
$function ? ( FUNCTION => $function ) : (),
);
$self->_CloseParen();

# HasNoUnreadMessages is the reverse of HasUnreadMessages
if ( !$FIELD_METADATA{$field}->[1] ) {
$self->Columns('id');
$orig_self->Limit(
%rest,
FIELD => 'id',
OPERATOR => 'NOT IN',
VALUE => '(' . $self->BuildSelectQuery( PreferBind => 0 ) . ')',
QUOTEVALUE => 0,
);
}
}


sub _LifecycleLimit {
my ( $self, $field, $op, $value, %rest ) = @_;
Expand Down Expand Up @@ -1648,7 +1792,7 @@ sub Limit {
if $self->{parsing_ticketsql} and not $args{LEFTJOIN};

$self->{_sql_looking_at}{ lc $args{FIELD} } = 1
if $args{FIELD} and (not $args{ALIAS} or $args{ALIAS} eq "main");
if $args{FIELD} and (not $args{ALIAS} or $args{ALIAS} eq "main") and not $args{LEFTJOIN};

$self->SUPER::Limit(%args);
}
Expand Down
3 changes: 3 additions & 0 deletions sbin/rt-server.in
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ $SIG{INT} = sub {
exit 0;
} if $> == 0;

# If a client goes away, don't allow this process to die.
$SIG{PIPE} = 'IGNORE';

$r->run;

__END__
Expand Down
3 changes: 2 additions & 1 deletion share/html/Elements/ShowCustomFieldBinary
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
% if (my $url = RT->System->ExternalStorageURLFor($Object)) {
<a href="<%$url%>">
% } else {
<a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content |un %>">
% my $home_path = RT->Config->Get('WebPath') . ( !$session{CurrentUser}->Privileged ? '/SelfService' : '' );
<a href="<% $home_path %>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content |un %>">
% }

<% $Object->Content %>
Expand Down
13 changes: 11 additions & 2 deletions share/html/Elements/ShowCustomFieldImage
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@
$Object
</%ARGS>
<%INIT>
my $url = RT->System->ExternalStorageURLFor($Object)
|| RT->Config->Get('WebPath') . "/Download/CustomFieldValue/".$Object->Id.'/'.$m->interp->apply_escapes($Object->Content, 'u');
my $url = RT->System->ExternalStorageURLFor($Object);
if ( !$url ) {
my $home_path = RT->Config->Get('WebPath') . ( !$session{CurrentUser}->Privileged ? '/SelfService' : '' );
$url
= $home_path
. "/Download/CustomFieldValue/"
. $Object->Id . '/'
. $m->interp->apply_escapes( $Object->Content, 'u' );

}

</%INIT>
Loading

0 comments on commit 0072407

Please sign in to comment.