]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Post/Edit.php
Use the post language for the language detection / config for quality
[friendica.git] / src / Module / Post / Edit.php
index ba6a7362045a6386497e9c5993b0fa3ff8c1fb9e..1505c301acf9b03473a8f93827d3cb64c57104b5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -82,8 +82,10 @@ class Edit extends BaseModule
                        $this->errorExit($this->t('Post not found.'), HTTPException\BadRequestException::class);
                }
 
-               $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
-                                  'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'];
+               $fields = [
+                       'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'gravity',
+                       'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'
+               ];
 
                $item = Post::selectFirstForUser($this->session->getLocalUserId(), $fields, [
                        'id'  => $postId,
@@ -94,16 +96,15 @@ class Edit extends BaseModule
                        $this->errorExit($this->t('Post not found.'), HTTPException\BadRequestException::class);
                }
 
-               $user   = User::getById($this->session->getLocalUserId());
-               $geoTag = '';
+               $user = User::getById($this->session->getLocalUserId());
 
                $output = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
                        '$title' => $this->t('Edit post'),
                ]);
 
                $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('jot-header.tpl'), [
-                       '$ispublic'  => '&nbsp;', // $this->t('Visible to <strong>everybody</strong>'),
-                       '$geotag'    => $geoTag,
+                       '$ispublic'  => '&nbsp;',
+                       '$geotag'    => '',
                        '$nickname'  => $this->app->getLoggedInUserNickname(),
                        '$is_mobile' => $this->mode->isMobile(),
                ]);
@@ -114,6 +115,9 @@ class Edit extends BaseModule
                        $lockstate = 'unlock';
                }
 
+               $item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
+               $item = Post\Media::addHTMLAttachmentToItem($item);
+
                $jotplugins = '';
 
                Hook::callAll('jot_tool', $jotplugins);
@@ -155,7 +159,7 @@ class Edit extends BaseModule
                        '$placeholdercategory' => (Feature::isEnabled($this->session->getLocalUserId(), 'categories') ? $this->t("Categories \x28comma-separated list\x29") : ''),
                        '$emtitle'             => $this->t('Example: bob@example.com, mary@example.com'),
                        '$lockstate'           => $lockstate,
-                       '$acl'                 => '', // populate_acl((($group) ? $group_acl : $a->user)),
+                       '$acl'                 => '',
                        '$bang'                => ($lockstate === 'lock' ? '!' : ''),
                        '$profile_uid'         => $this->session->getLocalUserId(),
                        '$preview'             => $this->t('Preview'),
@@ -164,18 +168,19 @@ class Edit extends BaseModule
                        '$rand_num'            => Crypto::randomDigits(12),
 
                        // Formatting button labels
-                       '$edbold'              => $this->t('Bold'),
-                       '$editalic'            => $this->t('Italic'),
-                       '$eduline'             => $this->t('Underline'),
-                       '$edquote'             => $this->t('Quote'),
-                       '$edcode'              => $this->t('Code'),
-                       '$edurl'               => $this->t('Link'),
-                       '$edattach'            => $this->t('Link or Media'),
+                       '$edbold'   => $this->t('Bold'),
+                       '$editalic' => $this->t('Italic'),
+                       '$eduline'  => $this->t('Underline'),
+                       '$edquote'  => $this->t('Quote'),
+                       '$edemojis' => $this->t('Add emojis'),
+                       '$edcode'   => $this->t('Code'),
+                       '$edurl'    => $this->t('Link'),
+                       '$edattach' => $this->t('Link or Media'),
 
                        //jot nav tab (used in some themes)
-                       '$message'             => $this->t('Message'),
-                       '$browser'             => $this->t('Browser'),
-                       '$shortpermset'        => $this->t('Permissions'),
+                       '$message'      => $this->t('Message'),
+                       '$browser'      => $this->t('Browser'),
+                       '$shortpermset' => $this->t('Permissions'),
 
                        '$compose_link_title' => $this->t('Open Compose page'),
                ]);