From acb8b3a40172ccb184ffe544760601d756692e6c Mon Sep 17 00:00:00 2001 From: Yassine Doghri <yassine@doghri.fr> Date: Fri, 16 Apr 2021 16:31:09 +0000 Subject: [PATCH] fix: check that note has a preview_card_id before displaying it fixes #114 --- app/Views/podcast/_partials/note.php | 9 ++++----- app/Views/podcast/_partials/note_authenticated.php | 9 ++++----- app/Views/podcast/_partials/reblog.php | 9 ++++----- app/Views/podcast/_partials/reblog_authenticated.php | 9 ++++----- app/Views/podcast/_partials/reply.php | 2 +- app/Views/podcast/_partials/reply_authenticated.php | 2 +- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/app/Views/podcast/_partials/note.php b/app/Views/podcast/_partials/note.php index 757f478588..d94f7eb390 100644 --- a/app/Views/podcast/_partials/note.php +++ b/app/Views/podcast/_partials/note.php @@ -27,15 +27,14 @@ </div> </header> <div class="px-6 mb-4 note-content"><?= $note->message_html ?></div> - <?php if ($note->preview_card): ?> - <?= view('podcast/_partials/preview_card', [ - 'preview_card' => $note->preview_card, - ]) ?> - <?php endif; ?> <?php if ($note->episode_id): ?> <?= view('podcast/_partials/episode_card', [ 'episode' => $note->episode, ]) ?> + <?php elseif ($note->preview_card_id): ?> + <?= view('podcast/_partials/preview_card', [ + 'preview_card' => $note->preview_card, + ]) ?> <?php endif; ?> <?= $this->include('podcast/_partials/note_actions') ?> </article> diff --git a/app/Views/podcast/_partials/note_authenticated.php b/app/Views/podcast/_partials/note_authenticated.php index 44279df1dc..01930eb245 100644 --- a/app/Views/podcast/_partials/note_authenticated.php +++ b/app/Views/podcast/_partials/note_authenticated.php @@ -27,15 +27,14 @@ </div> </header> <div class="px-6 mb-4 note-content"><?= $note->message_html ?></div> - <?php if ($note->preview_card): ?> - <?= view('podcast/_partials/preview_card', [ - 'preview_card' => $note->preview_card, - ]) ?> - <?php endif; ?> <?php if ($note->episode_id): ?> <?= view('podcast/_partials/episode_card', [ 'episode' => $note->episode, ]) ?> + <?php elseif ($note->preview_card_id): ?> + <?= view('podcast/_partials/preview_card', [ + 'preview_card' => $note->preview_card, + ]) ?> <?php endif; ?> <?= $this->include('podcast/_partials/note_actions_authenticated') ?> </article> diff --git a/app/Views/podcast/_partials/reblog.php b/app/Views/podcast/_partials/reblog.php index 12077674b1..fa014f1e91 100644 --- a/app/Views/podcast/_partials/reblog.php +++ b/app/Views/podcast/_partials/reblog.php @@ -34,15 +34,14 @@ </div> </header> <div class="px-6 mb-4 note-content"><?= $note->message_html ?></div> - <?php if ($note->preview_card): ?> - <?= view('podcast/_partials/preview_card', [ - 'preview_card' => $note->preview_card, - ]) ?> - <?php endif; ?> <?php if ($note->episode_id): ?> <?= view('podcast/_partials/episode_card', [ 'episode' => $note->episode, ]) ?> + <?php elseif ($note->preview_card_id): ?> + <?= view('podcast/_partials/preview_card', [ + 'preview_card' => $note->preview_card, + ]) ?> <?php endif; ?> <?= $this->include('podcast/_partials/note_actions') ?> </article> diff --git a/app/Views/podcast/_partials/reblog_authenticated.php b/app/Views/podcast/_partials/reblog_authenticated.php index bfb018068d..43ecf46012 100644 --- a/app/Views/podcast/_partials/reblog_authenticated.php +++ b/app/Views/podcast/_partials/reblog_authenticated.php @@ -34,15 +34,14 @@ </div> </header> <div class="px-6 mb-4 note-content"><?= $note->message_html ?></div> - <?php if ($note->preview_card): ?> - <?= view('podcast/_partials/preview_card', [ - 'preview_card' => $note->preview_card, - ]) ?> - <?php endif; ?> <?php if ($note->episode_id): ?> <?= view('podcast/_partials/episode_card', [ 'episode' => $note->episode, ]) ?> + <?php elseif ($note->preview_card_id): ?> + <?= view('podcast/_partials/preview_card', [ + 'preview_card' => $note->preview_card, + ]) ?> <?php endif; ?> <?= $this->include('podcast/_partials/note_actions_authenticated') ?> </article> diff --git a/app/Views/podcast/_partials/reply.php b/app/Views/podcast/_partials/reply.php index 2d36a450eb..c687a1e9c5 100644 --- a/app/Views/podcast/_partials/reply.php +++ b/app/Views/podcast/_partials/reply.php @@ -19,7 +19,7 @@ ><?= lang('Common.mediumDate', [$reply->published_at]) ?></time> </header> <p class="mb-2 note-content"><?= $reply->message_html ?></p> - <?php if ($reply->preview_card): ?> + <?php if ($reply->preview_card_id): ?> <?= view('podcast/_partials/preview_card', [ 'preview_card' => $reply->preview_card, ]) ?> diff --git a/app/Views/podcast/_partials/reply_authenticated.php b/app/Views/podcast/_partials/reply_authenticated.php index 739986fab0..e7dfebcfaa 100644 --- a/app/Views/podcast/_partials/reply_authenticated.php +++ b/app/Views/podcast/_partials/reply_authenticated.php @@ -19,7 +19,7 @@ ><?= lang('Common.mediumDate', [$reply->created_at]) ?></time> </header> <p class="mb-2 note-content"><?= $reply->message_html ?></p> - <?php if ($reply->preview_card): ?> + <?php if ($reply->preview_card_id): ?> <?= view('podcast/_partials/preview_card', [ 'preview_card' => $reply->preview_card, ]) ?> -- GitLab