Removed unnecessary userId=null checks
This commit is contained in:
parent
2d96b26a82
commit
62675a52a7
|
@ -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'.",
|
||||||
|
|
Loading…
Reference in New Issue