If there is no UID do not explode accessibility javascript

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-10-22 11:26:21 +02:00
parent f7538fcc82
commit 3ac15a45ea
No known key found for this signature in database
GPG key ID: F941078878347C0C

View file

@ -192,9 +192,17 @@ class AccessibilityController extends Controller {
* @return DataDownloadResponse * @return DataDownloadResponse
*/ */
public function getJavascript(): DataDownloadResponse { public function getJavascript(): DataDownloadResponse {
$user = $this->userSession->getUser();
if ($user === null) {
$theme = false;
} else {
$theme = $this->config->getUserValue($user->getUID(), $this->appName, 'theme', false);
}
$responseJS = '(function() { $responseJS = '(function() {
OCA.Accessibility = { OCA.Accessibility = {
theme: ' . json_encode($this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false)) . ', theme: ' . json_encode($theme) . ',
}; };
})();'; })();';