Commit 80bcdcfd authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Merge branch '4.0-trunk' into 4.2-trunk

This removes the preferences caching introduced in 4.2 in ddfeca8e,
replacing it with that of 4.0 from a273c51b and 5b707dfe.  It also
reolves a number of conflicts brought about by 4.0/utf8-reckoning and
its 4.2 counterpart.

Conflicts:
	lib/RT/Action/SendEmail.pm
	lib/RT/Attachment.pm
	lib/RT/Crypt/GnuPG.pm
	lib/RT/Dashboard/Mailer.pm
	lib/RT/I18N.pm
	lib/RT/I18N/fr.pm
	lib/RT/Interface/Email.pm
	lib/RT/Interface/Email/Auth/Crypt.pm
	lib/RT/Interface/Web.pm
	lib/RT/Record.pm
	lib/RT/Template.pm
	lib/RT/Ticket.pm
	lib/RT/Tickets.pm
	lib/RT/User.pm
	sbin/rt-test-dependencies.in
	share/html/Admin/Users/Modify.html
	share/html/Elements/EditCustomFieldDate
	share/html/Elements/EditCustomFieldDateTime
	share/html/NoAuth/css/aileron/ticket.css
	share/html/NoAuth/css/base/ticket.css
	share/html/Search/Results.tsv
	share/html/Ticket/Create.html
	share/html/Ticket/Elements/EditTransactionCustomFields
	share/html/Ticket/Elements/PreviewScrips
	share/html/Ticket/Update.html
	share/html/Tools/Offline.html
	t/api/i18n_guess.t
	t/mail/dashboard-chart-with-utf8.t
	t/mail/header-characters.t
	t/mail/sendmail.t
	t/web/offline_messages_utf8.t
	t/web/offline_utf8.t
	t/web/user_update.t
parents 2c2ae8b5 458598fc
......@@ -322,6 +322,7 @@ sub list {
}
if ( ! $rawprint and ! exists $data{format} ) {
$data{format} = 'l';
$data{fields} = 'subject,status,queue,created,told,owner,requestors';
}
if ( $reverse_sort and $data{orderby} =~ /^-/ ) {
$data{orderby} =~ s/^-/+/;
......
......@@ -9,7 +9,7 @@ This document walks through the steps to set up a
"Change requests" queue with approvals. You should try
this in a test instance first. If you don't have a test RT
instance, you should read through the entire document first,
change the details as needed for you approval scenario, and then
change the details as needed for your approval scenario, and then
set up approvals.
=head2 Overview
......
......@@ -181,9 +181,6 @@ sub Create {
$args{'ContentType'} = 'storable';
}
delete $RT::User::PREFERENCES_CACHE{ $args{'ObjectId'} }{ $args{'Name'} }
if $args{'ObjectType'} eq 'RT::User';
$self->SUPER::Create(
Name => $args{'Name'},
Content => $args{'Content'},
......@@ -278,11 +275,6 @@ sub SetContent {
my $self = shift;
my $content = shift;
if ( $self->__Value('ObjectType') eq 'RT::User' ) {
delete $RT::User::PREFERENCES_CACHE
{ $self->__Value('ObjectId') }{ $self->__Value('Name') };
}
# Call __Value to avoid ACL check.
if ( ($self->__Value('ContentType')||'') eq 'storable' ) {
# We eval the serialization because it will lose on a coderef.
......@@ -386,11 +378,6 @@ sub Delete {
return (0,$self->loc('Permission Denied'));
}
if ( $self->__Value('ObjectType') eq 'RT::User' ) {
delete $RT::User::PREFERENCES_CACHE
{ $self->__Value('ObjectId') }{ $self->__Value('Name') };
}
return($self->SUPER::Delete(@_));
}
......
......@@ -1262,7 +1262,6 @@ sub Get {
my $res;
if ( $user && $user->id && $META{$name}->{'Overridable'} ) {
$user = $user->UserObj if $user->isa('RT::CurrentUser');
my $prefs = $user->Preferences($RT::System);
$res = $prefs->{$name} if $prefs;
}
......
......@@ -54,7 +54,7 @@
use RT::CurrentUser;
# laod
# load
my $current_user = RT::CurrentUser->new;
$current_user->Load(...);
# or
......
......@@ -634,7 +634,7 @@ sub RescueOutlook {
# Add base64 since we've seen examples of double newlines with
# this type too. Need an example of a multi-part base64 to
# handle that permutation if it exists.
elsif ( $mime->head->get('Content-Transfer-Encoding') =~ m{base64} ) {
elsif ( ($mime->head->get('Content-Transfer-Encoding')||'') =~ m{base64} ) {
$text_part = $mime; # Assuming single part, already decoded.
}
......
......@@ -188,7 +188,6 @@ sub CleanupRequest {
}
%RT::Ticket::MERGE_CACHE = ( effective => {}, merged => {} );
%RT::User::PREFERENCES_CACHE = ();
# RT::System persists between requests, so its attributes cache has to be
# cleared manually. Without this, for example, subject tags across multiple
......
......@@ -180,6 +180,8 @@ shredding on most databases.
CREATE INDEX SHREDDER_TXN3 ON Transactions(Type, OldValue);
CREATE INDEX SHREDDER_TXN4 ON Transactions(Type, NewValue)
CREATE INDEX SHREDDER_ATTACHMENTS1 ON Attachments(Creator);
=head1 INFORMATION FOR DEVELOPERS
=head2 General API
......
......@@ -104,7 +104,6 @@ sub _OverlayAccessible {
Gecos => { public => 1, admin => 1 }, # loc_left_pair
PGPKey => { public => 1, admin => 1 }, # loc_left_pair
SMIMECertificate => { public => 1, admin => 1 }, # loc_left_pair
PrivateKey => { admin => 1 },
City => { public => 1 }, # loc_left_pair
Country => { public => 1 }, # loc_left_pair
Timezone => { public => 1 }, # loc_left_pair
......@@ -1383,24 +1382,13 @@ override the entries with user preferences.
=cut
our %PREFERENCES_CACHE = ();
sub Preferences {
my $self = shift;
my $name = _PrefName(shift);
my $default = shift;
my $content;
if ( exists $PREFERENCES_CACHE{ $self->id }{ $name } ) {
$content = $PREFERENCES_CACHE{ $self->id }{ $name };
}
else {
my $attr = RT::Attribute->new( $self->CurrentUser );
$attr->LoadByNameAndObject( Object => $self, Name => $name );
$PREFERENCES_CACHE{ $self->id }{ $name } = $content
= $attr->Id ? $attr->Content : undef;
}
my ($attr) = $self->Attributes->Named( $name );
my $content = $attr ? $attr->Content : undef;
unless ( ref $content eq 'HASH' ) {
return defined $content ? $content : $default;
}
......@@ -1429,11 +1417,8 @@ sub SetPreferences {
return (0, $self->loc("No permission to set preferences"))
unless $self->CurrentUserCanModify('Preferences');
# we clear cache in RT::Attribute
my $attr = RT::Attribute->new( $self->CurrentUser );
$attr->LoadByNameAndObject( Object => $self, Name => $name );
if ( $attr->Id ) {
my ($attr) = $self->Attributes->Named( $name );
if ( $attr ) {
my ($ok, $msg) = $attr->SetContent( $value );
return (1, "No updates made")
if $msg eq "That is already the current value";
......@@ -1456,13 +1441,11 @@ sub DeletePreferences {
return (0, $self->loc("No permission to set preferences"))
unless $self->CurrentUserCanModify('Preferences');
my $attr = RT::Attribute->new( $self->CurrentUser );
$attr->LoadByNameAndObject( Object => $self, Name => $name );
if ( $attr->Id ) {
return $attr->Delete;
}
my ($attr) = $self->DeleteAttribute( $name );
return (0, $self->loc("Preferences were not found"))
unless $attr;
return (0, $self->loc("Preferences were not found"));
return 1;
}
=head2 Stylesheet
......@@ -1828,7 +1811,8 @@ sub SetPrivateKey {
my $self = shift;
my $key = shift;
unless ($self->CurrentUserCanModify('PrivateKey')) {
# Users should not be able to change their own PrivateKey values
unless ( $self->CurrentUser->HasRight(Right => 'AdminUsers', Object => $RT::System) ) {
return (0, $self->loc("Permission Denied"));
}
......
......@@ -77,8 +77,8 @@ should wipeout.
Outputs INSERT queries into file. This dump can be used to restore data
after wiping out.
By default creates files
F<< <RT_home>/var/data/RT-Shredder/<ISO_date>-XXXX.sql >>
By default creates files named F<< <ISO_date>-XXXX.sql >> in the current
directory.
=head2 --object (DEPRECATED)
......
......@@ -105,7 +105,7 @@
<br />
<&| /Widgets/TitleBox, title => loc('Access control'), class => 'user-info-access-control' &>
<input type="hidden" class="hidden" name="SetEnabled" value="1" />
<input type="checkbox" class="checkbox" id="Enabled" name="Enabled" value="1" <%$EnabledChecked%> />
<input type="checkbox" class="checkbox" id="Enabled" name="Enabled" value="1" <%$EnabledChecked||''%> />
<label for="Enabled"><&|/l&>Let this user access RT</&></label><br />
......
......@@ -56,10 +56,10 @@
</div>
<%ARGS>
$Ticket
$DisplayPath => $session{'CurrentUser'}->Privileged ? 'Ticket' : 'SelfService'
</%ARGS>
<%INIT>
return unless (RT->Config->Get( 'ShowUnreadMessageNotifications', $session{'CurrentUser'}));
my $txn = $Ticket->SeenUpTo or return;
my $DisplayPath = $session{'CurrentUser'}->Privileged ? 'Ticket' : 'SelfService';
</%INIT>
......@@ -91,6 +91,10 @@
background-color: #cce;
}
.unread-messages .titlebox-content :link {
text-decoration: underline;
}
.ticket-inactive {
text-decoration: line-through;
color: #666
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment