Removed unnecessary userId=null checks

This commit is contained in:
Kalle Fagerberg 2022-09-18 19:45:15 +02:00 committed by thrillfall
parent 2d96b26a82
commit 62675a52a7
1 changed files with 1 additions and 13 deletions

View File

@ -13,7 +13,7 @@ use OCP\IRequest;
class PersonalSettingsController extends Controller { class PersonalSettingsController extends Controller {
private ?string $userId; private string $userId;
private PodcastMetricsReader $metricsReader; private PodcastMetricsReader $metricsReader;
private PodcastDataReader $dataReader; private PodcastDataReader $dataReader;
@ -38,12 +38,6 @@ class PersonalSettingsController extends Controller {
* @return JSONResponse * @return JSONResponse
*/ */
public function metrics(): JSONResponse { public function metrics(): JSONResponse {
if ($this->userId === null) {
return new JSONResponse([
'message' => "Unauthorized.",
'subscriptions' => null,
], statusCode: Http::STATUS_UNAUTHORIZED);
}
$metrics = $this->metricsReader->metrics($this->userId); $metrics = $this->metricsReader->metrics($this->userId);
return new JSONResponse([ return new JSONResponse([
'subscriptions' => $metrics, 'subscriptions' => $metrics,
@ -58,12 +52,6 @@ class PersonalSettingsController extends Controller {
* @return JsonResponse * @return JsonResponse
*/ */
public function podcastData(string $url = ''): JsonResponse { public function podcastData(string $url = ''): JsonResponse {
if ($this->userId === null) {
return new JSONResponse([
'message' => "Unauthorized.",
'data' => null,
], statusCode: Http::STATUS_UNAUTHORIZED);
}
if ($url === '') { if ($url === '') {
return new JSONResponse([ return new JSONResponse([
'message' => "Missing query parameter 'url'.", 'message' => "Missing query parameter 'url'.",