mirror of
https://framagit.org/tom79/fediplan.git
synced 2025-04-09 15:41:49 +02:00
Some fixes
This commit is contained in:
parent
f9172b14f6
commit
470dc8c714
5 changed files with 54 additions and 59 deletions
src
Controller
Security
Services
SocialEntity
|
@ -143,11 +143,12 @@ class FediPlanController extends AbstractController
|
|||
|
||||
$pollOption1 = new PollOption();
|
||||
$pollOption1->setTitle("");
|
||||
$compose->getPollOptions()->add($pollOption1);
|
||||
$options = $compose->getPollOptions();
|
||||
$options[] = $pollOption1;
|
||||
$pollOption2 = new PollOption();
|
||||
$pollOption2->setTitle("");
|
||||
$compose->getPollOptions()->add($pollOption2);
|
||||
/* @var $user MastodonAccount */
|
||||
$options[] = $pollOption2;
|
||||
$compose->setPollOptions($options);
|
||||
$user = $this->getUser();
|
||||
$form = $this->createForm(ComposeType::class, $compose, ['user' => $user]);
|
||||
$form->handleRequest($request);
|
||||
|
@ -231,10 +232,12 @@ class FediPlanController extends AbstractController
|
|||
$compose = new Compose();
|
||||
$pollOption1 = new PollOption();
|
||||
$pollOption1->setTitle("");
|
||||
$compose->getPollOptions()->add($pollOption1);
|
||||
$options = $compose->getPollOptions();
|
||||
$options[] = $pollOption1;
|
||||
$pollOption2 = new PollOption();
|
||||
$pollOption2->setTitle("");
|
||||
$compose->getPollOptions()->add($pollOption2);
|
||||
$options[] = $pollOption2;
|
||||
$compose->setPollOptions($options);
|
||||
$session->getFlashBag()->add(
|
||||
'Success',
|
||||
$translator->trans('common.schedule_success', [], 'fediplan', 'en')
|
||||
|
|
|
@ -5,59 +5,58 @@ namespace App\Security;
|
|||
use App\SocialEntity\Client;
|
||||
use App\SocialEntity\CustomField;
|
||||
use App\SocialEntity\Emoji;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
class MastodonAccount implements UserInterface
|
||||
{
|
||||
private $acct;
|
||||
private $id;
|
||||
private string $acct;
|
||||
private string $id;
|
||||
|
||||
private $account_id;
|
||||
private string $account_id;
|
||||
|
||||
private $username;
|
||||
private string $username;
|
||||
|
||||
private $display_name;
|
||||
private string $display_name;
|
||||
|
||||
private $locked;
|
||||
private bool $locked;
|
||||
|
||||
private $created_at;
|
||||
private \DateTime $created_at;
|
||||
|
||||
private $followers_count;
|
||||
private int $followers_count;
|
||||
|
||||
private $following_count;
|
||||
private int $following_count;
|
||||
|
||||
private $statuses_count;
|
||||
private int $statuses_count;
|
||||
|
||||
private $note;
|
||||
private string $note;
|
||||
|
||||
private $url;
|
||||
private string $url;
|
||||
|
||||
private $avatar;
|
||||
private string $avatar;
|
||||
|
||||
private $avatar_static;
|
||||
private string $avatar_static;
|
||||
|
||||
private $header;
|
||||
private string $header;
|
||||
|
||||
private $header_static;
|
||||
private string $header_static;
|
||||
|
||||
private $moved;
|
||||
private MastodonAccount $moved;
|
||||
|
||||
private $bot;
|
||||
private bool $bot;
|
||||
|
||||
private $instance;
|
||||
private string $instance;
|
||||
|
||||
private $client;
|
||||
private Client $client;
|
||||
|
||||
private $token;
|
||||
private string $token;
|
||||
|
||||
private $Fields;
|
||||
private array $Fields;
|
||||
/** @var Emoji[] */
|
||||
private array $Emojis;
|
||||
|
||||
private $Emojis;
|
||||
private string $default_sensitivity;
|
||||
|
||||
private $default_sensitivity;
|
||||
|
||||
private $default_visibility;
|
||||
private string $default_visibility;
|
||||
|
||||
|
||||
public function __construct()
|
||||
|
@ -323,59 +322,52 @@ class MastodonAccount implements UserInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|CustomField[]
|
||||
*/
|
||||
public function getFields(): Collection
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return $this->Fields;
|
||||
}
|
||||
|
||||
public function addField(CustomField $field): self
|
||||
{
|
||||
if (!$this->Fields->contains($field)) {
|
||||
if (in_array($field, $this->Fields) !== false) {
|
||||
$this->Fields[] = $field;
|
||||
$field->setMastodonAccount($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeField(CustomField $field): self
|
||||
{
|
||||
if ($this->Fields->contains($field)) {
|
||||
$this->Fields->removeElement($field);
|
||||
|
||||
if (($key = array_search($field, $this->Fields)) !== false) {
|
||||
unset($this->Fields[$key]);
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($field->getMastodonAccount() === $this) {
|
||||
$field->setMastodonAccount(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Emoji[]
|
||||
*/
|
||||
public function getEmojis(): Collection
|
||||
public function getEmojis(): array
|
||||
{
|
||||
return $this->Emojis;
|
||||
}
|
||||
|
||||
public function addEmoji(Emoji $emoji): self
|
||||
{
|
||||
if (!$this->Emojis->contains($emoji)) {
|
||||
if (in_array($emoji, $this->Emojis) !== false) {
|
||||
$this->Emojis[] = $emoji;
|
||||
$emoji->setMastodonAccount($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeEmoji(Emoji $emoji): self
|
||||
{
|
||||
if ($this->Emojis->contains($emoji)) {
|
||||
$this->Emojis->removeElement($emoji);
|
||||
if (($key = array_search($emoji, $this->Emojis)) !== false) {
|
||||
unset($this->Emojis[$key]);
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($emoji->getMastodonAccount() === $this) {
|
||||
$emoji->setMastodonAccount(null);
|
||||
|
@ -389,7 +381,7 @@ class MastodonAccount implements UserInterface
|
|||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDefaultSensitivity()
|
||||
public function getDefaultSensitivity(): mixed
|
||||
{
|
||||
return $this->default_sensitivity;
|
||||
}
|
||||
|
|
|
@ -1241,7 +1241,7 @@ class Mastodon_api
|
|||
return $MastodonAccount;
|
||||
}
|
||||
|
||||
public function stringToDate(string $string_date): DateTime
|
||||
public function stringToDate(?string $string_date): DateTime
|
||||
{
|
||||
try {
|
||||
return new DateTime($string_date);
|
||||
|
|
|
@ -10,21 +10,21 @@ class Compose
|
|||
{
|
||||
|
||||
private string $id;
|
||||
private string $content_warning;
|
||||
private string $content;
|
||||
private ?string $content_warning = null;
|
||||
private ?string $content = null;
|
||||
|
||||
private string $visibility;
|
||||
private DateTime $created_at;
|
||||
private DateTime $scheduled_at;
|
||||
private DateTime $sent_at;
|
||||
private bool $sensitive;
|
||||
private string $in_reply_to_id;
|
||||
private ?string $in_reply_to_id = null;
|
||||
|
||||
private string $timeZone;
|
||||
/** @var PollOption[] */
|
||||
private array $poll_options;
|
||||
private int $poll_expires_at;
|
||||
private bool $poll_multiple;
|
||||
private ?array $poll_options = null;
|
||||
private ?int $poll_expires_at = null;
|
||||
private ?bool $poll_multiple = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -6,8 +6,8 @@ namespace App\SocialEntity;
|
|||
|
||||
class PollOption
|
||||
{
|
||||
private string $title;
|
||||
private int $votes_count;
|
||||
private ?string $title = null;
|
||||
private ?int $votes_count = null;
|
||||
|
||||
|
||||
public function getTitle(): ?string
|
||||
|
|
Loading…
Add table
Reference in a new issue