diff --git a/components/Bridge/Bridge.php b/components/Bridge/Bridge.php index e65157b924..8d7ada332e 100644 --- a/components/Bridge/Bridge.php +++ b/components/Bridge/Bridge.php @@ -19,7 +19,7 @@ namespace Component\Bridge; -use App\Core\Module; +use App\Core\Modules\Module; class Bridge extends Module { diff --git a/components/Left/Left.php b/components/Left/Left.php index d1fa80fde8..78c50d2660 100644 --- a/components/Left/Left.php +++ b/components/Left/Left.php @@ -21,7 +21,7 @@ namespace Component\Left; use App\Core\Event; use App\Core\Log; -use App\Core\Module; +use App\Core\Modules\Module; use App\Util\Common; use Exception; diff --git a/components/Media/Media.php b/components/Media/Media.php index d1938b78e2..1c7c40bdbf 100644 --- a/components/Media/Media.php +++ b/components/Media/Media.php @@ -21,7 +21,7 @@ namespace Component\Media; use App\Core\Cache; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; use App\Util\Common; use App\Util\Nickname; diff --git a/components/Posting/Posting.php b/components/Posting/Posting.php index 656334f9ed..6c606f1043 100644 --- a/components/Posting/Posting.php +++ b/components/Posting/Posting.php @@ -23,7 +23,7 @@ use App\Core\DB\DB; use App\Core\Event; use App\Core\Form; use function App\Core\I18n\_m; -use App\Core\Module; +use App\Core\Modules\Module; use App\Core\Security; use App\Entity\FileToNote; use App\Entity\Note; diff --git a/config/services.yaml b/config/services.yaml index b1ac9a1f96..b119a1c83c 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -24,7 +24,7 @@ services: App\Core\Router\RouteLoader: tags: ['routing.loader'] - # Wrapper arround Doctrine's StaticPHP metadata driver + # Wrapper around Doctrine's StaticPHP metadata driver app.schemadef_driver: class: App\DependencyInjection\Compiler\SchemaDefDriver arguments: diff --git a/plugins/Cover/Cover.php b/plugins/Cover/Cover.php index 2158c797c8..20fb6144d4 100644 --- a/plugins/Cover/Cover.php +++ b/plugins/Cover/Cover.php @@ -22,7 +22,7 @@ namespace Plugin\Cover; use App\Core\DB\DB; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; use App\Core\Router\RouteLoader; use App\Util\Common; diff --git a/plugins/Directory/Directory.php b/plugins/Directory/Directory.php index a700e0c42b..b565ff1d8a 100644 --- a/plugins/Directory/Directory.php +++ b/plugins/Directory/Directory.php @@ -22,7 +22,7 @@ namespace Plugin\Directory; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; use App\Core\Router\RouteLoader; class Directory extends Module diff --git a/plugins/EmailNotifications/EmailNotifications.php b/plugins/EmailNotifications/EmailNotifications.php index 5c27296eba..3fb4c70341 100644 --- a/plugins/EmailNotifications/EmailNotifications.php +++ b/plugins/EmailNotifications/EmailNotifications.php @@ -33,7 +33,7 @@ namespace Plugin\EmailNotifications; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; class EmailNotifications extends Module { diff --git a/plugins/Embed/Embed.php b/plugins/Embed/Embed.php index f6792eb64e..5740c9efc3 100644 --- a/plugins/Embed/Embed.php +++ b/plugins/Embed/Embed.php @@ -32,7 +32,7 @@ namespace Plugin\Embed; -use App\Core\Module; +use App\Core\Modules\Module; /** * Base class for the Embed plugin that does most of the heavy lifting to get diff --git a/plugins/Favourite/Favourite.php b/plugins/Favourite/Favourite.php index 1329df1974..4837371786 100644 --- a/plugins/Favourite/Favourite.php +++ b/plugins/Favourite/Favourite.php @@ -22,10 +22,10 @@ namespace Plugin\Favourite; use App\Core\DB\DB; use App\Core\Event; use App\Core\Form; -use App\Core\Module; -use App\Entity\Favourite as Fave; +use App\Core\Modules\Module; use App\Entity\Note; use App\Util\Common; +use Plugin\Favourite\Entity\Favourite as Fave; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; diff --git a/plugins/Media/Media.php b/plugins/Media/Media.php index f60ff9c5db..ce9385ff2b 100644 --- a/plugins/Media/Media.php +++ b/plugins/Media/Media.php @@ -20,7 +20,7 @@ namespace Plugin\Media; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; use App\Core\Router\RouteLoader; class Media extends Module diff --git a/plugins/Poll/Poll.php b/plugins/Poll/Poll.php index fcf8fb6344..157b92c855 100644 --- a/plugins/Poll/Poll.php +++ b/plugins/Poll/Poll.php @@ -24,7 +24,7 @@ use App\Core\DB\DB; use App\Core\Event; use App\Core\Form; use function App\Core\I18n\_m; -use App\Core\Module; +use App\Core\Modules\Module; use App\Core\Router\RouteLoader; use App\Entity\Note; use App\Entity\PollResponse; diff --git a/plugins/ProfileColor/ProfileColor.php b/plugins/ProfileColor/ProfileColor.php index e7de756a08..ffd4020f2e 100644 --- a/plugins/ProfileColor/ProfileColor.php +++ b/plugins/ProfileColor/ProfileColor.php @@ -22,7 +22,7 @@ namespace Plugin\ProfileColor; use App\Core\DB\DB; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; use App\Core\Router\RouteLoader; use App\Util\Common; diff --git a/plugins/Repeat/Repeat.php b/plugins/Repeat/Repeat.php index fe84f23787..a7b9ce6156 100644 --- a/plugins/Repeat/Repeat.php +++ b/plugins/Repeat/Repeat.php @@ -22,7 +22,7 @@ namespace Plugin\Repeat; use App\Core\DB\DB; use App\Core\Event; use App\Core\Form; -use App\Core\Module; +use App\Core\Modules\Module; use App\Entity\Note; use App\Util\Common; use App\Util\Exception\NotFoundException; diff --git a/plugins/Reply/Reply.php b/plugins/Reply/Reply.php index 9657790e62..259a37d93b 100644 --- a/plugins/Reply/Reply.php +++ b/plugins/Reply/Reply.php @@ -25,7 +25,7 @@ use App\Core\DB\DB; use App\Core\Event; use App\Core\Form; use function App\Core\I18n\_m; -use App\Core\Module; +use App\Core\Modules\Module; use App\Entity\Note; use App\Util\Common; use App\Util\Exceptiion\InvalidFormException; diff --git a/plugins/StoreRemoteMedia/StoreRemoteMedia.php b/plugins/StoreRemoteMedia/StoreRemoteMedia.php index 4af322d92a..17165d458a 100644 --- a/plugins/StoreRemoteMedia/StoreRemoteMedia.php +++ b/plugins/StoreRemoteMedia/StoreRemoteMedia.php @@ -16,7 +16,7 @@ namespace Plugin\StoreRemoteMedia; -use App\Core\Module; +use App\Core\Modules\Module; /** * The StoreRemoteMedia plugin downloads remotely attached files to local server. diff --git a/plugins/TreeNotes/TreeNotes.php b/plugins/TreeNotes/TreeNotes.php index 99c9ea5805..8cbf561949 100644 --- a/plugins/TreeNotes/TreeNotes.php +++ b/plugins/TreeNotes/TreeNotes.php @@ -19,10 +19,8 @@ namespace Plugin\TreeNotes; +use App\Core\Modules\Module; use App\Entity\Note; -use App\Core\Event; -use App\Core\Module; -use Functional as F; class TreeNotes extends Module { @@ -31,7 +29,7 @@ class TreeNotes extends Module */ public function onFormatNoteList(array &$notes_in_trees_out) { - $roots = array_filter($notes_in_trees_out, function(Note $note) { return $note->getReplyTo() == null; }, ARRAY_FILTER_USE_BOTH); + $roots = array_filter($notes_in_trees_out, function (Note $note) { return $note->getReplyTo() == null; }, ARRAY_FILTER_USE_BOTH); $notes_in_trees_out = $this->build_tree($roots, $notes_in_trees_out); } @@ -46,7 +44,7 @@ class TreeNotes extends Module private function build_subtree(Note $parent, array $notes) { - $children = array_filter($notes, function(Note $n) use ($parent) { return $parent->getId() == $n->getReplyTo(); }, ARRAY_FILTER_USE_BOTH); + $children = array_filter($notes, function (Note $n) use ($parent) { return $parent->getId() == $n->getReplyTo(); }, ARRAY_FILTER_USE_BOTH); return ['note' => $parent, 'replies' => $this->build_tree($children, $notes)]; } } diff --git a/plugins/FFmpeg/FFmpeg.php b/plugins/VideoThumbnail/FFmpeg.php similarity index 99% rename from plugins/FFmpeg/FFmpeg.php rename to plugins/VideoThumbnail/FFmpeg.php index 7973a1de54..5a521b12d1 100644 --- a/plugins/FFmpeg/FFmpeg.php +++ b/plugins/VideoThumbnail/FFmpeg.php @@ -28,7 +28,7 @@ namespace Plugin\FFmpeg; -use App\Core\Module; +use App\Core\Modules\Module; use Plugin\Media\Util\ImageFile; class FFmpeg extends Module diff --git a/plugins/FFmpeg/README.md b/plugins/VideoThumbnail/README.md similarity index 100% rename from plugins/FFmpeg/README.md rename to plugins/VideoThumbnail/README.md diff --git a/plugins/VideoThumbnail/locale/FFmpeg.pot b/plugins/VideoThumbnail/locale/FFmpeg.pot new file mode 100644 index 0000000000..023e887f6e --- /dev/null +++ b/plugins/VideoThumbnail/locale/FFmpeg.pot @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-08-13 03:09+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. TRANS: Plugin description. +#: FFmpegPlugin.php:104 +msgid "Use PHP-FFMpeg for resizing animated GIFs" +msgstr "" diff --git a/plugins/FFmpeg/locale/en_GB/LC_MESSAGES/FFmpeg.po b/plugins/VideoThumbnail/locale/en_GB/LC_MESSAGES/FFmpeg.po similarity index 100% rename from plugins/FFmpeg/locale/en_GB/LC_MESSAGES/FFmpeg.po rename to plugins/VideoThumbnail/locale/en_GB/LC_MESSAGES/FFmpeg.po diff --git a/plugins/FFmpeg/locale/pt/LC_MESSAGES/FFmpeg.po b/plugins/VideoThumbnail/locale/pt/LC_MESSAGES/FFmpeg.po similarity index 100% rename from plugins/FFmpeg/locale/pt/LC_MESSAGES/FFmpeg.po rename to plugins/VideoThumbnail/locale/pt/LC_MESSAGES/FFmpeg.po diff --git a/plugins/XMPPNotifications/XMPPNotifications.php b/plugins/XMPPNotifications/XMPPNotifications.php index eef98891c9..6c6f0d7237 100644 --- a/plugins/XMPPNotifications/XMPPNotifications.php +++ b/plugins/XMPPNotifications/XMPPNotifications.php @@ -33,7 +33,7 @@ namespace Plugin\XMPPNotifications; use App\Core\Event; -use App\Core\Module; +use App\Core\Modules\Module; class XMPPNotifications extends Module { diff --git a/src/Core/Module.php b/src/Core/Modules/Module.php similarity index 99% rename from src/Core/Module.php rename to src/Core/Modules/Module.php index 1d829b77a5..aac565c4c9 100644 --- a/src/Core/Module.php +++ b/src/Core/Modules/Module.php @@ -17,7 +17,7 @@ // along with GNU social. If not, see . // }}} -namespace App\Core; +namespace App\Core\Modules; use App\Entity\Note; use App\Util\Common; diff --git a/src/Core/Modules/RemoteAttachmentDownload.php b/src/Core/Modules/RemoteAttachmentDownload.php new file mode 100644 index 0000000000..9f25d1afed --- /dev/null +++ b/src/Core/Modules/RemoteAttachmentDownload.php @@ -0,0 +1,12 @@ +is_local; } - public function setIsNsfw(?bool $is_nsfw): self - { - $this->is_nsfw = $is_nsfw; - return $this; - } - - public function getIsNsfw(): ?bool - { - return $this->is_nsfw; - } - public function setIsUrlProtected(?bool $is_url_protected): self { $this->is_url_protected = $is_url_protected; @@ -233,18 +222,17 @@ class File extends Entity return [ 'name' => 'file', 'fields' => [ - 'id' => ['type' => 'serial', 'not null' => true], - 'url' => ['type' => 'text', 'description' => 'URL after following possible redirections'], - 'url_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'], - 'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'], - 'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'description' => 'If set, used so each actor can have a version of this file (for avatars, for instance)'], - 'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'], - 'title' => ['type' => 'text', 'description' => 'title of resource when available'], - 'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'title of resource when available'], - 'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'], - 'is_nsfw' => ['type' => 'bool', 'default' => false, 'description' => 'whether the file is NSFW'], - 'is_url_protected' => ['type' => 'bool', 'default' => false, 'description' => 'true when URL is private (needs login)'], - 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], + 'id' => ['type' => 'serial', 'not null' => true], + 'remote_url' => ['type' => 'text', 'description' => 'URL after following possible redirections'], + 'remote_url_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'], + 'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'], + 'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'description' => 'If set, used so each actor can have a version of this file (for avatars, for instance)'], + 'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'], + 'title' => ['type' => 'text', 'description' => 'title of resource when available'], + 'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'title of resource when available'], + 'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'], + 'source' => ['type' => 'int', 'default' => null, 'description' => 'Source of the Attachment (upload, TFN, embed)'], + 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], ], 'primary key' => ['id'], 'unique keys' => [ diff --git a/src/Security/Authenticator.php b/src/Security/Authenticator.php index 55a77dbd47..30fdc140db 100644 --- a/src/Security/Authenticator.php +++ b/src/Security/Authenticator.php @@ -96,7 +96,7 @@ class Authenticator extends AbstractFormLoginAuthenticator $user = DB::findOneBy('local_user', ['or' => ['nickname' => $nick, 'outgoing_email' => $nick]]); } catch (Exception $e) { throw new CustomUserMessageAuthenticationException( - _m('\'{nickname}\' doesn\'t match any registered nickname or email.', ['{nickname}' => $credentials['nickname']])); + _m('\'{nickname}\' doesn\'t match any registered nickname or email.', ['nickname' => $credentials['nickname']])); } return $user; diff --git a/templates/note/view.html.twig b/templates/note/view.html.twig index 1a1e471639..a353391c47 100644 --- a/templates/note/view.html.twig +++ b/templates/note/view.html.twig @@ -25,9 +25,10 @@ {% for attachment in note.getAttachments() %} {% if attachment.mimetype starts with 'image/' %}
- {{ attachment.getTitle() }} - {{ attachment.getTitle() }} - +
+ {{ attachment.getTitle() }} +
{{ attachment.getTitle() }}
+
{% elseif attachment.mimetype starts with 'video/' %}
@@ -45,14 +46,16 @@
{% if have_user %} - {% for act in get_note_actions(note) %} - {{ form(act) }} - {% endfor %} + {#{% for act in get_note_actions(note) %}#} + {#{{ form(act) }}#} + {#{% endfor %}#} {% endif %}
-
- {% for conversation in replies %} - {% include '/note/view.html.twig' with {'note': conversation['note'], 'skip_reply_to': true, 'have_user': have_user, 'replies': conversation['replies']} only %} - {% endfor %} -
+ {% if replies is defined %} +
+ {% for conversation in replies %} + {% include '/note/view.html.twig' with {'note': conversation['note'], 'skip_reply_to': true, 'have_user': have_user, 'replies': conversation['replies']} only %} + {% endfor %} +
+ {% endif %}