From cd6fad2e3b4fa069907763747c1fbc7041e14069 Mon Sep 17 00:00:00 2001
From: Thomas
Date: Fri, 10 May 2024 16:57:17 +0200
Subject: [PATCH] Fix some issues
---
src/SocialEntity/Status.php | 28 ++++++++++++------------
templates/fediplan/Ajax/layout.html.twig | 26 ++++++++++++++++++++--
2 files changed, 38 insertions(+), 16 deletions(-)
diff --git a/src/SocialEntity/Status.php b/src/SocialEntity/Status.php
index 669ae85..b2bfb30 100644
--- a/src/SocialEntity/Status.php
+++ b/src/SocialEntity/Status.php
@@ -12,9 +12,9 @@ class Status
private string $uri;
private string $url;
private MastodonAccount $account;
- private string $in_reply_to_id;
- private string $in_reply_to_account_id;
- private string $content;
+ private ?string $in_reply_to_id;
+ private ?string $in_reply_to_account_id;
+ private ?string $content;
private DateTime $created_at;
private DateTime $scheduled_at;
/** @var Emoji[] */
@@ -26,7 +26,7 @@ class Status
private bool $favourited;
private bool $muted;
private bool $sensitive_;
- private string $spoiler_text;
+ private ?string $spoiler_text;
private string $visibility;
/** @var Attachment[] */
private array $media_attachments = [];
@@ -106,15 +106,15 @@ class Status
}
/**
- * @return string
+ * @return string|null
*/
- public function getInReplyToId(): string
+ public function getInReplyToId(): ?string
{
return $this->in_reply_to_id;
}
/**
- * @param string $in_reply_to_id
+ * @param mixed $in_reply_to_id
*/
public function setInReplyToId(?string $in_reply_to_id): void
{
@@ -130,7 +130,7 @@ class Status
}
/**
- * @param string $in_reply_to_account_id
+ * @param mixed $in_reply_to_account_id
*/
public function setInReplyToAccountId(?string $in_reply_to_account_id): void
{
@@ -138,17 +138,17 @@ class Status
}
/**
- * @return string
+ * @return string|null
*/
- public function getContent(): string
+ public function getContent(): ?string
{
return $this->content;
}
/**
- * @param string $content
+ * @param mixed $content
*/
- public function setContent(string $content): void
+ public function setContent(?string $content): void
{
$this->content = $content;
}
@@ -162,7 +162,7 @@ class Status
}
/**
- * @param DateTime $created_at
+ * @param mixed $created_at
*/
public function setCreatedAt(?DateTime $created_at): void
{
@@ -323,7 +323,7 @@ class Status
}
/**
- * @param string $spoiler_text
+ * @param mixed $spoiler_text
*/
public function setSpoilerText(?string $spoiler_text): void
{
diff --git a/templates/fediplan/Ajax/layout.html.twig b/templates/fediplan/Ajax/layout.html.twig
index eddd89d..baa6542 100644
--- a/templates/fediplan/Ajax/layout.html.twig
+++ b/templates/fediplan/Ajax/layout.html.twig
@@ -14,10 +14,27 @@
{% if status.spoilerText is defined %}
{{ status.spoilerText }}
{% endif %}
- {{ status.content | nl2br }}
+ {% if status.content is not null %}
+ {{ status.content | nl2br }}
+ {% endif %}
+ {% if status.getMediaAttachments() is not null and status.getMediaAttachments() | length > 0%}
+
+
+ {% for media in status.getMediaAttachments() %}
+

+ {% endfor %}
+
+
+ {% endif %}