From cf0e92365008f012d6be9ead3647d75777cb3e05 Mon Sep 17 00:00:00 2001 From: Chirag Chhatrala <60499540+chiragchhatrala@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:09:33 +0530 Subject: [PATCH 1/2] remove extra files (#233) Co-authored-by: Forms Dev --- .../forms/fields/FormBlockOptionsModal.vue | 204 ------ .../forms/fields/FormFieldOptionsModal.vue | 579 ------------------ 2 files changed, 783 deletions(-) delete mode 100644 resources/js/components/open/forms/fields/FormBlockOptionsModal.vue delete mode 100644 resources/js/components/open/forms/fields/FormFieldOptionsModal.vue diff --git a/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue b/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue deleted file mode 100644 index 7c2e4e05a..000000000 --- a/resources/js/components/open/forms/fields/FormBlockOptionsModal.vue +++ /dev/null @@ -1,204 +0,0 @@ - - - diff --git a/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue b/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue deleted file mode 100644 index fa4428c38..000000000 --- a/resources/js/components/open/forms/fields/FormFieldOptionsModal.vue +++ /dev/null @@ -1,579 +0,0 @@ - - - From 8de1c94291a9c74cf454a80f7197d55bcf27c0cd Mon Sep 17 00:00:00 2001 From: formsdev <136701234+formsdev@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:05:21 +0530 Subject: [PATCH 2/2] Fix the template API (#234) --- app/Http/Controllers/TemplateController.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/TemplateController.php b/app/Http/Controllers/TemplateController.php index 8a89614d6..04a1b2acc 100644 --- a/app/Http/Controllers/TemplateController.php +++ b/app/Http/Controllers/TemplateController.php @@ -15,7 +15,7 @@ public function index(Request $request) { $limit = null; if ($request->offsetExists('limit') && $request->get('limit') > 0) { - $limit = (int) $request->get('limit'); + $limit = (int)$request->get('limit'); } $onlyMy = false; @@ -24,12 +24,18 @@ public function index(Request $request) } $templates = Template::limit($limit) - ->when(Auth::check() && !$onlyMy, function ($query) { - $query->where('publicly_listed', true); - $query->orWhere('creator_id', Auth::id()); + ->when(Auth::check(), function ($query) use ($onlyMy) { + if ($onlyMy) { + $query->where('creator_id', Auth::id()); + } else { + $query->where(function ($query) { + $query->where('publicly_listed', true) + ->orWhere('creator_id', Auth::id()); + }); + } }) - ->when(Auth::check() && $onlyMy, function ($query) { - $query->where('creator_id', Auth::id()); + ->when(!Auth::check(), function ($query) { + return $query->publiclyListed(); }) ->orderByDesc('created_at') ->get();