-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IUserPreferences #47658
base: master
Are you sure you want to change the base?
IUserPreferences #47658
Conversation
6d81b97
to
a9e2a38
Compare
e9ec009
to
cda7029
Compare
1fbb6a9
to
317202a
Compare
c78f304
to
979ecee
Compare
979ecee
to
41ba78f
Compare
8edb1c1
to
e510535
Compare
f71bb7d
to
e24d29a
Compare
32c209d
to
b80315b
Compare
b80315b
to
0c489af
Compare
0c489af
to
6ae7f9f
Compare
ceb814d
to
a219133
Compare
lib/private/UserPreferences.php
Outdated
$value = $cache[$app][$key]; | ||
try { | ||
$this->decryptSensitiveValue($userId, $app, $key, $value); | ||
$value = $this->convertTypedValue($value, $typedAs ?? $this->getValueType($userId, (string)$app, $key, $lazy)); |
Check failure
Code scanning / Psalm
RedundantCast
lib/private/UserPreferences.php
Outdated
* @param string $value preference value | ||
* @param bool $caseInsensitive non-case-sensitive search, only works if $value is a string | ||
* | ||
* @return list<string> |
Check failure
Code scanning / Psalm
MoreSpecificReturnType
lib/private/UserPreferences.php
Outdated
* @since 31.0.0 | ||
*/ | ||
public function searchUsersByValueString(string $app, string $key, string $value, bool $caseInsensitive = false): array { | ||
return $this->searchUsersByTypedValue($app, $key, $value, $caseInsensitive); |
Check failure
Code scanning / Psalm
LessSpecificReturnStatement
lib/private/UserPreferences.php
Outdated
* @param string $key preference key | ||
* @param array $values list of preference values | ||
* | ||
* @return list<string> |
Check failure
Code scanning / Psalm
MoreSpecificReturnType
lib/private/UserPreferences.php
Outdated
* @since 31.0.0 | ||
*/ | ||
public function searchUsersByValues(string $app, string $key, array $values): array { | ||
return $this->searchUsersByTypedValue($app, $key, $values); |
Check failure
Code scanning / Psalm
LessSpecificReturnStatement
cc4a1ff
to
da769f0
Compare
lib/private/UserPreferences.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, please split that file before it gets out of hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I thought about it .. even started to split into 3:
IUserPreferences
for basic getters/setters on user preferences.IUserPreferencesExtra
that extendsIUserPreferences
and add all direct value manipulation on the cache likeis[Lazy|Sensitive|Indexed]
,update[Lazy|Sensitive|Indexed]
, ...IAdvancedUserPreferences
for search
but it makes everything bad. I will keep it like this (using a single file) until PHP can define a class from multiple files :-]
Please note that there is a lot of single line method that request 10 lines of PHPDoc ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stopped at line 1050 of UserPreferences, to be continued…
I dislike the sensitive flag thing, it should be a bool just like lazy so that all types var can be typed to the enum.
lib/private/UserPreferences.php
Outdated
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid cluttering OC namespace please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move to \OC\UserPreferences\Manager
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving everything into \OC\Config
and \OCP\Config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's keep it private for one major version to have the flexibility to change the API down the road?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to note this somewhere (feel free to ignore):
For me the name if a bit confusing (I know the DB table is called like that),
as we have IConfig
and IAppConfig
I would expect IUserConfig
as the name.
6e0abf9
to
e04730a
Compare
While I think grouping API might happens if we start today to create this API within |
lib/private/UserPreferences.php
Outdated
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving everything into \OC\Config
and \OCP\Config
17eeef9
to
6a3a4a1
Compare
Signed-off-by: Maxence Lange <[email protected]>
Signed-off-by: Maxence Lange <[email protected]>
Signed-off-by: Maxence Lange <[email protected]>
6a3a4a1
to
ebeff96
Compare
IConfig
's preferences-related method