forked from GNUsocial/gnu-social
[AUTOGENERATED] Update auto generated code
This commit is contained in:
@@ -59,7 +59,7 @@ class Attachment extends Entity
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $id;
|
||||
private int $lives = 1;
|
||||
private int $lives;
|
||||
private ?string $filehash;
|
||||
private ?string $mimetype;
|
||||
private ?string $filename;
|
||||
@@ -79,19 +79,20 @@ class Attachment extends Entity
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setLives(int $lives): self
|
||||
{
|
||||
$this->lives = $lives;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLives(): int
|
||||
{
|
||||
return $this->lives;
|
||||
}
|
||||
|
||||
public function setLives(int $lives): void
|
||||
{
|
||||
$this->lives = $lives;
|
||||
}
|
||||
|
||||
public function setFilehash(?string $filehash): self
|
||||
{
|
||||
$this->filehash = $filehash;
|
||||
$this->filehash = mb_substr($filehash, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ class Attachment extends Entity
|
||||
|
||||
public function setMimetype(?string $mimetype): self
|
||||
{
|
||||
$this->mimetype = $mimetype;
|
||||
$this->mimetype = mb_substr($mimetype, 0, 255);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -113,7 +114,7 @@ class Attachment extends Entity
|
||||
|
||||
public function setFilename(?string $filename): self
|
||||
{
|
||||
$this->filename = $filename;
|
||||
$this->filename = mb_substr($filename, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -317,7 +318,6 @@ class Attachment extends Entity
|
||||
Event::handle('AttachmentGetBestTitle', [$this, $note, &$title]);
|
||||
return $title;
|
||||
}
|
||||
|
||||
});
|
||||
if ($title != null) {
|
||||
return $title;
|
||||
|
||||
@@ -66,12 +66,11 @@ class AttachmentThumbnail extends Entity
|
||||
'medium' => self::SIZE_MEDIUM,
|
||||
'big' => self::SIZE_BIG,
|
||||
];
|
||||
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $attachment_id;
|
||||
private ?string $mimetype;
|
||||
private int $size = self::SIZE_SMALL;
|
||||
private int $size = 0;
|
||||
private string $filename;
|
||||
private int $width;
|
||||
private int $height;
|
||||
@@ -90,7 +89,7 @@ class AttachmentThumbnail extends Entity
|
||||
|
||||
public function setMimetype(?string $mimetype): self
|
||||
{
|
||||
$this->mimetype = $mimetype;
|
||||
$this->mimetype = mb_substr($mimetype, 0, 129);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -99,20 +98,20 @@ class AttachmentThumbnail extends Entity
|
||||
return $this->mimetype;
|
||||
}
|
||||
|
||||
public function getSize(): int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function setSize(int $size): self
|
||||
{
|
||||
$this->size = $size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize(): int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function setFilename(string $filename): self
|
||||
{
|
||||
$this->filename = $filename;
|
||||
$this->filename = mb_substr($filename, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -121,6 +120,28 @@ class AttachmentThumbnail extends Entity
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
public function setWidth(int $width): self
|
||||
{
|
||||
$this->width = $width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWidth(): int
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
public function setHeight(int $height): self
|
||||
{
|
||||
$this->height = $height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHeight(): int
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
{
|
||||
$this->modified = $modified;
|
||||
@@ -132,28 +153,6 @@ class AttachmentThumbnail extends Entity
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
public function getWidth(): int
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
public function setWidth(int $width): self
|
||||
{
|
||||
$this->width = $width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHeight(): int
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
public function setHeight(int $height): self
|
||||
{
|
||||
$this->height = $height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
||||
@@ -39,21 +39,10 @@ class AttachmentToLink extends Entity
|
||||
{
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $attachment_id;
|
||||
private int $link_id;
|
||||
private int $attachment_id;
|
||||
private DateTimeInterface $modified;
|
||||
|
||||
public function setAttachmentId(int $attachment_id): self
|
||||
{
|
||||
$this->attachment_id = $attachment_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAttachmentId(): int
|
||||
{
|
||||
return $this->attachment_id;
|
||||
}
|
||||
|
||||
public function setLinkId(int $link_id): self
|
||||
{
|
||||
$this->link_id = $link_id;
|
||||
@@ -65,6 +54,17 @@ class AttachmentToLink extends Entity
|
||||
return $this->link_id;
|
||||
}
|
||||
|
||||
public function setAttachmentId(int $attachment_id): self
|
||||
{
|
||||
$this->attachment_id = $attachment_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAttachmentId(): int
|
||||
{
|
||||
return $this->attachment_id;
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
{
|
||||
$this->modified = $modified;
|
||||
|
||||
@@ -77,16 +77,17 @@ class Avatar extends Entity
|
||||
return $this->attachment_id;
|
||||
}
|
||||
|
||||
public function setTitle(?string $title): self
|
||||
{
|
||||
$this->title = mb_substr($title, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle(?string $title): void
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
{
|
||||
$this->created = $created;
|
||||
|
||||
@@ -88,7 +88,7 @@ class ForeignLink
|
||||
|
||||
public function setCredentials(?string $credentials): self
|
||||
{
|
||||
$this->credentials = $credentials;
|
||||
$this->credentials = mb_substr($credentials, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class ForeignService
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->name = mb_substr($name, 0, 32);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class ForeignService
|
||||
|
||||
public function setDescription(?string $description): self
|
||||
{
|
||||
$this->description = $description;
|
||||
$this->description = mb_substr($description, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class ForeignUser
|
||||
|
||||
public function setUri(string $uri): self
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$this->uri = mb_substr($uri, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class ForeignUser
|
||||
|
||||
public function setNickname(?string $nickname): self
|
||||
{
|
||||
$this->nickname = $nickname;
|
||||
$this->nickname = mb_substr($nickname, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ class Conversation extends Entity
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $id;
|
||||
private string $uri;
|
||||
private int $initial_note_id;
|
||||
|
||||
public function setId(int $id): self
|
||||
|
||||
@@ -38,7 +38,6 @@ use App\Core\Log;
|
||||
use App\Core\VisibilityScope;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Common;
|
||||
use function array_key_exists;
|
||||
|
||||
abstract class FeedController extends Controller
|
||||
{
|
||||
@@ -51,7 +50,7 @@ abstract class FeedController extends Controller
|
||||
{
|
||||
$actor = Common::actor();
|
||||
|
||||
if (array_key_exists('notes', $result)) {
|
||||
if (\array_key_exists('notes', $result)) {
|
||||
$notes = $result['notes'];
|
||||
self::enforceScope($notes, $actor);
|
||||
Event::handle('FilterNoteList', [$actor, &$notes, $result['request']]);
|
||||
@@ -64,20 +63,20 @@ abstract class FeedController extends Controller
|
||||
private static function enforceScope(array &$notes, ?Actor $actor): void
|
||||
{
|
||||
$filtered_notes = [];
|
||||
foreach($notes as $note) {
|
||||
switch($note->getScope()) {
|
||||
foreach ($notes as $note) {
|
||||
switch ($note->getScope()) {
|
||||
case VisibilityScope::LOCAL: // The controller handles it if private
|
||||
case VisibilityScope::PUBLIC:
|
||||
$filtered_notes[] = $note;
|
||||
break;
|
||||
case VisibilityScope::ADDRESSEE:
|
||||
// If the actor is logged in and
|
||||
if (!is_null($actor) &&
|
||||
(
|
||||
if (!\is_null($actor)
|
||||
&& (
|
||||
// Is either the author Or
|
||||
$note->getActorId() == $actor->getId() ||
|
||||
$note->getActorId() == $actor->getId()
|
||||
// one of the targets
|
||||
in_array($actor->getId(), $note->getNotificationTargetIds())
|
||||
|| \in_array($actor->getId(), $note->getNotificationTargetIds())
|
||||
)) {
|
||||
$filtered_notes[] = $note;
|
||||
}
|
||||
@@ -85,7 +84,7 @@ abstract class FeedController extends Controller
|
||||
case VisibilityScope::GROUP:
|
||||
// Only for the group to see
|
||||
break;
|
||||
case VisibilityScope::COLLECTION: // no break
|
||||
case VisibilityScope::COLLECTION:
|
||||
case VisibilityScope::MESSAGE:
|
||||
// Only for the collection to see (they will only find it in their notifications)
|
||||
break;
|
||||
|
||||
@@ -47,27 +47,27 @@ use DateTimeInterface;
|
||||
class FreeNetworkActorProtocol extends Entity
|
||||
{
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart;
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $actor_id;
|
||||
private ?string $protocol;
|
||||
private ?string $addr;
|
||||
private string $addr;
|
||||
private DateTimeInterface $created;
|
||||
private DateTimeInterface $modified;
|
||||
|
||||
public function getActorId(): int
|
||||
{
|
||||
return $this->actor_id;
|
||||
}
|
||||
|
||||
public function setActorId(int $actor_id): self
|
||||
{
|
||||
$this->actor_id = $actor_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getActorId(): int
|
||||
{
|
||||
return $this->actor_id;
|
||||
}
|
||||
|
||||
public function setProtocol(?string $protocol): self
|
||||
{
|
||||
$this->protocol = $protocol;
|
||||
$this->protocol = mb_substr($protocol, 0, 32);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -87,14 +87,20 @@ class FreeNetworkActorProtocol extends Entity
|
||||
return $this->addr;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
{
|
||||
$this->created = $created;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
{
|
||||
$this->created = $created;
|
||||
$this->modified = $modified;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -103,11 +109,6 @@ class FreeNetworkActorProtocol extends Entity
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
{
|
||||
$this->modified = $modified;
|
||||
return $this;
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
||||
@@ -71,16 +71,17 @@ class ActorLanguage extends Entity
|
||||
return $this->language_id;
|
||||
}
|
||||
|
||||
public function getOrdering(): int
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
public function setOrdering(int $ordering): self
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOrdering(): int
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ class Language extends Entity
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $id;
|
||||
private string $locale;
|
||||
private string $long_display;
|
||||
private string $short_display;
|
||||
private ?string $locale;
|
||||
private ?string $long_display;
|
||||
private ?string $short_display;
|
||||
private DateTimeInterface $created;
|
||||
|
||||
public function setId(int $id): self
|
||||
@@ -64,35 +64,35 @@ class Language extends Entity
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setLocale(string $locale): self
|
||||
public function setLocale(?string $locale): self
|
||||
{
|
||||
$this->locale = $locale;
|
||||
$this->locale = mb_substr($locale, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLocale(): string
|
||||
public function getLocale(): ?string
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setLongDisplay(string $long_display): self
|
||||
public function setLongDisplay(?string $long_display): self
|
||||
{
|
||||
$this->long_display = $long_display;
|
||||
$this->long_display = mb_substr($long_display, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLongDisplay(): string
|
||||
public function getLongDisplay(): ?string
|
||||
{
|
||||
return $this->long_display;
|
||||
}
|
||||
|
||||
public function setShortDisplay(string $short_display): self
|
||||
public function setShortDisplay(?string $short_display): self
|
||||
{
|
||||
$this->short_display = $short_display;
|
||||
$this->short_display = mb_substr($short_display, 0, 12);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShortDisplay(): string
|
||||
public function getShortDisplay(): ?string
|
||||
{
|
||||
return $this->short_display;
|
||||
}
|
||||
@@ -107,6 +107,7 @@ class Language extends Entity
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class Language extends Component
|
||||
}
|
||||
$notes = F\select(
|
||||
$notes,
|
||||
fn (Note $n) => is_null($n->getLanguageId()) || \in_array($n->getLanguageId(), ActorLanguage::getActorRelatedLanguagesIds($actor)),
|
||||
fn (Note $n) => \is_null($n->getLanguageId()) || \in_array($n->getLanguageId(), ActorLanguage::getActorRelatedLanguagesIds($actor)),
|
||||
);
|
||||
|
||||
return Event::next;
|
||||
|
||||
@@ -65,20 +65,20 @@ class Link extends Entity
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function setUrl(?string $url): self
|
||||
{
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function setUrlHash(?string $url_hash): self
|
||||
{
|
||||
$this->url_hash = $url_hash;
|
||||
$this->url_hash = mb_substr($url_hash, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class Link extends Entity
|
||||
|
||||
public function setMimetype(?string $mimetype): self
|
||||
{
|
||||
$this->mimetype = $mimetype;
|
||||
$this->mimetype = mb_substr($mimetype, 0, 50);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -98,18 +98,6 @@ class Link extends Entity
|
||||
return $this->mimetype;
|
||||
}
|
||||
|
||||
public function getMimetypeMajor(): ?string
|
||||
{
|
||||
$mime = $this->getMimetype();
|
||||
return \is_null($mime) ? $mime : GSFile::mimetypeMajor($mime);
|
||||
}
|
||||
|
||||
public function getMimetypeMinor(): ?string
|
||||
{
|
||||
$mime = $this->getMimetype();
|
||||
return \is_null($mime) ? $mime : GSFile::mimetypeMinor($mime);
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
{
|
||||
$this->modified = $modified;
|
||||
@@ -172,6 +160,18 @@ class Link extends Entity
|
||||
}
|
||||
}
|
||||
|
||||
public function getMimetypeMajor(): ?string
|
||||
{
|
||||
$mime = $this->getMimetype();
|
||||
return \is_null($mime) ? $mime : GSFile::mimetypeMajor($mime);
|
||||
}
|
||||
|
||||
public function getMimetypeMinor(): ?string
|
||||
{
|
||||
$mime = $this->getMimetype();
|
||||
return \is_null($mime) ? $mime : GSFile::mimetypeMinor($mime);
|
||||
}
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -76,6 +76,7 @@ class NoteToLink extends Entity
|
||||
{
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class Notification extends Entity
|
||||
|
||||
public function setReason(?string $reason): self
|
||||
{
|
||||
$this->reason = $reason;
|
||||
$this->reason = mb_substr($reason, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class UserNotificationPrefs extends Entity
|
||||
|
||||
public function setTransport(string $transport): self
|
||||
{
|
||||
$this->transport = $transport;
|
||||
$this->transport = mb_substr($transport, 0, 191);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,21 +24,20 @@ declare(strict_types = 1);
|
||||
namespace Component\Posting;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Entity;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Core\GSFile;
|
||||
use App\Core\VisibilityScope;
|
||||
use App\Util\Exception\BugFoundException;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Modules\Component;
|
||||
use App\Core\Router\Router;
|
||||
use App\Core\Security;
|
||||
use App\Core\VisibilityScope;
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Actor;
|
||||
use App\Entity\GroupInbox;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\BugFoundException;
|
||||
use App\Util\Exception\ClientException;
|
||||
use App\Util\Exception\DuplicateFoundException;
|
||||
use App\Util\Exception\RedirectException;
|
||||
@@ -58,8 +57,6 @@ use Symfony\Component\HttpFoundation\File\Exception\FormSizeFileException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use function count;
|
||||
use function is_null;
|
||||
|
||||
class Posting extends Component
|
||||
{
|
||||
@@ -73,7 +70,7 @@ class Posting extends Component
|
||||
*/
|
||||
public function onAppendRightPostingBlock(Request $request, array &$res): bool
|
||||
{
|
||||
if (is_null($user = Common::user())) {
|
||||
if (\is_null($user = Common::user())) {
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
@@ -105,15 +102,15 @@ class Posting extends Component
|
||||
|
||||
// TODO: if in group page, add GROUP visibility to the choices.
|
||||
$form_params[] = ['visibility', ChoiceType::class, ['label' => _m('Visibility:'), 'multiple' => false, 'expanded' => false, 'data' => 'public', 'choices' => [
|
||||
_m('Public') => VisibilityScope::PUBLIC,
|
||||
_m('Local') => VisibilityScope::LOCAL,
|
||||
_m('Addressee') => VisibilityScope::ADDRESSEE
|
||||
_m('Public') => VisibilityScope::PUBLIC,
|
||||
_m('Local') => VisibilityScope::LOCAL,
|
||||
_m('Addressee') => VisibilityScope::ADDRESSEE,
|
||||
]]];
|
||||
$form_params[] = ['content', TextareaType::class, ['label' => _m('Content:'), 'data' => $initial_content, 'attr' => ['placeholder' => _m($placeholder)], 'constraints' => [new Length(['max' => Common::config('site', 'text_limit')])]]];
|
||||
$form_params[] = ['attachments', FileType::class, ['label' => _m('Attachments:'), 'multiple' => true, 'required' => false, 'invalid_message' => _m('Attachment not valid.')]];
|
||||
$form_params[] = FormFields::language($actor, $context_actor, label: _m('Note language'), help: _m('The selected language will be federated and added as a lang attribute, preferred language can be set up in settings'));
|
||||
|
||||
if (count($available_content_types) > 1) {
|
||||
if (\count($available_content_types) > 1) {
|
||||
$form_params[] = ['content_type', ChoiceType::class,
|
||||
[
|
||||
'label' => _m('Text format:'), 'multiple' => false, 'expanded' => false,
|
||||
@@ -174,32 +171,25 @@ class Posting extends Component
|
||||
* $actor_id, possibly as a reply to note $reply_to and with flag
|
||||
* $is_local. Sanitizes $content and $attachments
|
||||
*
|
||||
* @param Actor $actor
|
||||
* @param string|null $content
|
||||
* @param string $content_type
|
||||
* @param string|null $language
|
||||
* @param int|null $scope
|
||||
* @param string|null $target
|
||||
* @param array $attachments Array of UploadedFile to be stored as GSFiles associated to this note
|
||||
* @param array $processed_attachments Array of [Attachment, Attachment's name] to be associated to this $actor and Note
|
||||
* @param array $attachments Array of UploadedFile to be stored as GSFiles associated to this note
|
||||
* @param array $processed_attachments Array of [Attachment, Attachment's name] to be associated to this $actor and Note
|
||||
* @param array $process_note_content_extra_args Extra arguments for the event ProcessNoteContent
|
||||
*
|
||||
* @return Note
|
||||
* @throws BugFoundException
|
||||
* @throws ClientException
|
||||
* @throws DuplicateFoundException
|
||||
* @throws ServerException
|
||||
* @throws BugFoundException
|
||||
*/
|
||||
public static function storeLocalNote(
|
||||
Actor $actor,
|
||||
Actor $actor,
|
||||
?string $content,
|
||||
string $content_type,
|
||||
string $content_type,
|
||||
?string $language = null,
|
||||
?int $scope = null,
|
||||
?int $scope = null,
|
||||
?string $target = null,
|
||||
array $attachments = [],
|
||||
array $processed_attachments = [],
|
||||
array $process_note_content_extra_args = [],
|
||||
array $attachments = [],
|
||||
array $processed_attachments = [],
|
||||
array $process_note_content_extra_args = [],
|
||||
): Note {
|
||||
$scope ??= VisibilityScope::PUBLIC; // TODO: If site is private, default to LOCAL
|
||||
$rendered = null;
|
||||
@@ -213,9 +203,9 @@ class Posting extends Component
|
||||
'content' => $content,
|
||||
'content_type' => $content_type,
|
||||
'rendered' => $rendered,
|
||||
'language_id' => !is_null($language) ? Language::getByLocale($language)->getId() : null,
|
||||
'language_id' => !\is_null($language) ? Language::getByLocale($language)->getId() : null,
|
||||
'is_local' => true,
|
||||
'scope' => $scope,
|
||||
'scope' => $scope,
|
||||
]);
|
||||
|
||||
/** @var UploadedFile[] $attachments */
|
||||
@@ -261,7 +251,7 @@ class Posting extends Component
|
||||
]);
|
||||
DB::persist($activity);
|
||||
|
||||
if (!is_null($target)) {
|
||||
if (!\is_null($target)) {
|
||||
switch ($target[0]) {
|
||||
case '!':
|
||||
$mentions[] = [
|
||||
@@ -277,7 +267,7 @@ class Posting extends Component
|
||||
|
||||
$mentioned = [];
|
||||
foreach (F\unique(F\flat_map($mentions, fn (array $m) => $m['mentioned'] ?? []), fn (Actor $a) => $a->getId()) as $m) {
|
||||
if (!is_null($m)) {
|
||||
if (!\is_null($m)) {
|
||||
$mentioned[] = $m->getId();
|
||||
|
||||
if ($m->isGroup()) {
|
||||
|
||||
Reference in New Issue
Block a user