Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
best-practical
rt
Commits
e04582df
Commit
e04582df
authored
Sep 03, 2014
by
Kevin Falcone
Browse files
Merge branch '4.0/cache-empty-preferences' into 4.0-trunk
parents
a8560893
5b707dfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
14 deletions
+8
-14
lib/RT/Config.pm
lib/RT/Config.pm
+0
-1
lib/RT/User.pm
lib/RT/User.pm
+8
-13
No files found.
lib/RT/Config.pm
View file @
e04582df
...
...
@@ -1013,7 +1013,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
;
}
...
...
lib/RT/User.pm
View file @
e04582df
...
...
@@ -1342,10 +1342,8 @@ sub Preferences {
my
$name
=
_PrefName
(
shift
);
my
$default
=
shift
;
my
$attr
=
RT::
Attribute
->
new
(
$self
->
CurrentUser
);
$attr
->
LoadByNameAndObject
(
Object
=>
$self
,
Name
=>
$name
);
my
$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
;
}
...
...
@@ -1374,9 +1372,8 @@ sub SetPreferences {
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
)
{
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
";
...
...
@@ -1399,13 +1396,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment