Unverified Commit 76a4bf34 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(types): update fake seeders types + fix bugs

parent c72f4be6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -107,9 +107,9 @@ class ContributorController extends BaseController
    {
        try {
            (new PodcastModel())->addPodcastContributor(
                $this->request->getPost('user'),
                (int) $this->request->getPost('user'),
                $this->podcast->id,
                $this->request->getPost('role'),
                (int) $this->request->getPost('role'),
            );
        } catch (Exception) {
            return redirect()
@@ -157,7 +157,7 @@ class ContributorController extends BaseController
        (new PodcastModel())->updatePodcastContributor(
            $this->user->id,
            $this->podcast->id,
            $this->request->getPost('role'),
            (int) $this->request->getPost('role'),
        );

        return redirect()->route('contributor-list', [$this->podcast->id]);
+4 −4
Original line number Diff line number Diff line
@@ -661,8 +661,8 @@ class EpisodeController extends BaseController
                $data = [
                    'podcast_id' => $this->podcast->id,
                    'episode_id' => $this->episode->id,
                    'start_time' => (int) $soundbite['start_time'],
                    'duration' => (int) $soundbite['duration'],
                    'start_time' => (float) $soundbite['start_time'],
                    'duration' => (float) $soundbite['duration'],
                    'label' => $soundbite['label'],
                    'updated_by' => user_id(),
                ];
@@ -688,9 +688,9 @@ class EpisodeController extends BaseController
        return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
    }

    public function soundbiteDelete(int $soundbiteId): RedirectResponse
    public function soundbiteDelete(string $soundbiteId): RedirectResponse
    {
        (new SoundbiteModel())->deleteSoundbite($this->podcast->id, $this->episode->id, $soundbiteId);
        (new SoundbiteModel())->deleteSoundbite($this->podcast->id, $this->episode->id, (int) $soundbiteId);

        return redirect()->route('soundbites-edit', [$this->podcast->id, $this->episode->id]);
    }
+2 −2
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ class EpisodePersonController extends BaseController
        return redirect()->back();
    }

    public function remove(int $personId): RedirectResponse
    public function remove(string $personId): RedirectResponse
    {
        (new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, $personId);
        (new PersonModel())->removePersonFromEpisode($this->podcast->id, $this->episode->id, (int) $personId);

        return redirect()->back();
    }
+31 −9
Original line number Diff line number Diff line
@@ -182,6 +182,15 @@ class PodcastController extends BaseController
                ->with('errors', $this->validator->getErrors());
        }

        if (
            ($partnerId = $this->request->getPost('partner_id')) === '' ||
            ($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
            ($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
            $partnerId = null;
            $partnerLinkUrl = null;
            $partnerImageUrl = null;
        }

        $podcast = new Podcast([
            'title' => $this->request->getPost('title'),
            'name' => $this->request->getPost('name'),
@@ -199,11 +208,13 @@ class PodcastController extends BaseController
            'type' => $this->request->getPost('type'),
            'copyright' => $this->request->getPost('copyright'),
            'location' => new Location($this->request->getPost('location_name'),),
            'payment_pointer' => $this->request->getPost('payment_pointer'),
            'payment_pointer' => $this->request->getPost(
                'payment_pointer'
            ) === '' ? null : $this->request->getPost('payment_pointer'),
            'custom_rss_string' => $this->request->getPost('custom_rss'),
            'partner_id' => $this->request->getPost('partner_id'),
            'partner_link_url' => $this->request->getPost('partner_link_url'),
            'partner_image_url' => $this->request->getPost('partner_image_url'),
            'partner_id' => $partnerId,
            'partner_link_url' => $partnerLinkUrl,
            'partner_image_url' => $partnerImageUrl,
            'is_blocked' => $this->request->getPost('block') === 'yes',
            'is_completed' => $this->request->getPost('complete') === 'yes',
            'is_locked' => $this->request->getPost('lock') === 'yes',
@@ -227,7 +238,7 @@ class PodcastController extends BaseController
        $authorize = Services::authorization();
        $podcastAdminGroup = $authorize->group('podcast_admin');

        $podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id);
        $podcastModel->addPodcastContributor(user_id(), $newPodcastId, (int) $podcastAdminGroup->id);

        // set Podcast categories
        (new CategoryModel())->setPodcastCategories(
@@ -277,6 +288,15 @@ class PodcastController extends BaseController
                ->with('errors', $this->validator->getErrors());
        }

        if (
            ($partnerId = $this->request->getPost('partner_id')) === '' ||
            ($partnerLinkUrl = $this->request->getPost('partner_link_url')) === '' ||
            ($partnerImageUrl = $this->request->getPost('partner_image_url')) === '') {
            $partnerId = null;
            $partnerLinkUrl = null;
            $partnerImageUrl = null;
        }

        $this->podcast->title = $this->request->getPost('title');
        $this->podcast->description_markdown = $this->request->getPost('description');

@@ -296,11 +316,13 @@ class PodcastController extends BaseController
        $this->podcast->type = $this->request->getPost('type');
        $this->podcast->copyright = $this->request->getPost('copyright');
        $this->podcast->location = new Location($this->request->getPost('location_name'));
        $this->podcast->payment_pointer = $this->request->getPost('payment_pointer');
        $this->podcast->payment_pointer = $this->request->getPost(
            'payment_pointer'
        ) === '' ? null : $this->request->getPost('payment_pointer');
        $this->podcast->custom_rss_string = $this->request->getPost('custom_rss');
        $this->podcast->partner_id = $this->request->getPost('partner_id');
        $this->podcast->partner_link_url = $this->request->getPost('partner_link_url');
        $this->podcast->partner_image_url = $this->request->getPost('partner_image_url');
        $this->podcast->partner_id = $partnerId;
        $this->podcast->partner_link_url = $partnerLinkUrl;
        $this->podcast->partner_image_url = $partnerImageUrl;
        $this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
        $this->podcast->is_completed =
            $this->request->getPost('complete') === 'yes';
+7 −7
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ class PodcastImportController extends BaseController
        $authorize = Services::authorization();
        $podcastAdminGroup = $authorize->group('podcast_admin');

        $podcastModel->addPodcastContributor(user_id(), $newPodcastId, $podcastAdminGroup->id);
        $podcastModel->addPodcastContributor(user_id(), $newPodcastId, (int) $podcastAdminGroup->id);

        $podcastsPlatformsData = [];
        $platformTypes = [
@@ -218,7 +218,7 @@ class PodcastImportController extends BaseController
        foreach ($platformTypes as $platformType) {
            foreach ($platformType['elements'] as $platform) {
                $platformLabel = $platform->attributes()['platform'];
                $platformSlug = slugify($platformLabel);
                $platformSlug = slugify((string) $platformLabel);
                if ($platformModel->getPlatform($platformSlug) !== null) {
                    $podcastsPlatformsData[] = [
                        'platform_slug' => $platformSlug,
@@ -246,7 +246,7 @@ class PodcastImportController extends BaseController
                    'full_name' => $fullName,
                    'unique_name' => slugify($fullName),
                    'information_url' => $podcastPerson->attributes()['href'],
                    'image' => new Image(download_file($podcastPerson->attributes()['img'])),
                    'image' => new Image(download_file((string) $podcastPerson->attributes()['img'])),
                    'created_by' => user_id(),
                    'updated_by' => user_id(),
                ]);
@@ -301,7 +301,7 @@ class PodcastImportController extends BaseController

            $slug = slugify(
                $this->request->getPost('slug_field') === 'title'
                    ? $item->title
                    ? (string) $item->title
                    : basename($item->link),
            );
            if (in_array($slug, $slugs, true)) {
@@ -342,7 +342,7 @@ class PodcastImportController extends BaseController
                'guid' => $item->guid ?? null,
                'title' => $item->title,
                'slug' => $slug,
                'audio_file' => download_file($item->enclosure->attributes()['url'],),
                'audio_file' => download_file((string) $item->enclosure->attributes()['url'],),
                'description_markdown' => $converter->convert($itemDescriptionHtml,),
                'description_html' => $itemDescriptionHtml,
                'image' => $episodeImage,
@@ -372,7 +372,7 @@ class PodcastImportController extends BaseController
                'location' => $location,
                'created_by' => user_id(),
                'updated_by' => user_id(),
                'published_at' => strtotime($item->pubDate),
                'published_at' => strtotime((string) $item->pubDate),
            ]);

            $episodeModel = new EpisodeModel();
@@ -396,7 +396,7 @@ class PodcastImportController extends BaseController
                        'full_name' => $fullName,
                        'unique_name' => slugify($fullName),
                        'information_url' => $episodePerson->attributes()['href'],
                        'image' => new Image(download_file($episodePerson->attributes()['img'])),
                        'image' => new Image(download_file((string) $episodePerson->attributes()['img'])),
                        'created_by' => user_id(),
                        'updated_by' => user_id(),
                    ]);
Loading