From f1843c8aac9ab959fed7b72d55247bd655b9543a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 1 Apr 2023 08:07:48 -0400 Subject: [PATCH 01/17] Fix Register namespace confusion in Model\User - Address https://github.com/friendica/friendica/issues/12486#issuecomment-1491861831 --- src/Model/User.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Model/User.php b/src/Model/User.php index 66b4cf1ff6..11d55e7f7e 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -35,7 +35,7 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Module\Register; +use Friendica\Module; use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Security\TwoFactor\Model\AppSpecificPassword; use Friendica\Network\HTTPException; @@ -1890,17 +1890,17 @@ class User } $register_policy = DI::config()->get('config', 'register_policy'); - if (!in_array($register_policy, [Register::OPEN, Register::CLOSED])) { + if (!in_array($register_policy, [Module\Register::OPEN, Module\Register::CLOSED])) { Logger::debug('Unsupported register policy.', ['policy' => $register_policy]); return; } $users = DBA::count('user', ['blocked' => false, 'account_removed' => false, 'account_expired' => false]); - if (($users >= $max_registered_users) && ($register_policy == Register::OPEN)) { - DI::config()->set('config', 'register_policy', Register::CLOSED); + if (($users >= $max_registered_users) && ($register_policy == Module\Register::OPEN)) { + DI::config()->set('config', 'register_policy', Module\Register::CLOSED); Logger::notice('Max users reached, registration is closed.', ['users' => $users, 'max' => $max_registered_users]); - } elseif (($users < $max_registered_users) && ($register_policy == Register::CLOSED)) { - DI::config()->set('config', 'register_policy', Register::OPEN); + } elseif (($users < $max_registered_users) && ($register_policy == Module\Register::CLOSED)) { + DI::config()->set('config', 'register_policy', Module\Register::OPEN); Logger::notice('Below maximum users, registration is opened.', ['users' => $users, 'max' => $max_registered_users]); } else { Logger::debug('Unchanged register policy', ['policy' => $register_policy, 'users' => $users, 'max' => $max_registered_users]); From 508807af1c6d8c1c66a73b26e4d5739e554ed451 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 1 Apr 2023 08:11:05 -0400 Subject: [PATCH 02/17] Fix namespace issue with posix function in Worker\Repository\Process - [Composer] Add ext-posix dependency - [Composer] Sort latest added dependencies alphabetically - Address https://github.com/friendica/friendica/issues/12486#issuecomment-1492842672 --- composer.json | 7 ++++--- src/Core/Worker/Repository/Process.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 509605b1ca..bb675c651e 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-openssl": "*", + "ext-posix": "*", "ext-simplexml": "*", "ext-xml": "*", "asika/simple-console": "^1.0", @@ -34,6 +35,7 @@ "friendica/json-ld": "^1.0", "geekwright/po": "^2.0", "guzzlehttp/guzzle": "^6.5", + "kornrunner/blurhash": "^1.2", "league/html-to-markdown": "^4.8", "level-2/dice": "^4", "lightopenid/lightopenid": "dev-master", @@ -49,6 +51,7 @@ "phpseclib/phpseclib": "^3.0", "pragmarx/google2fa": "^5.0", "pragmarx/recovery": "^0.2", + "psr/clock": "^1.0", "psr/container": "^1.0", "psr/log": "^1.1", "seld/cli-prompt": "^1.0", @@ -71,9 +74,7 @@ "npm-asset/moment": "^2.24", "npm-asset/perfect-scrollbar": "0.6.16", "npm-asset/textcomplete": "^0.18.2", - "npm-asset/typeahead.js": "^0.11.1", - "kornrunner/blurhash": "^1.2", - "psr/clock": "^1.0" + "npm-asset/typeahead.js": "^0.11.1" }, "repositories": [ { diff --git a/src/Core/Worker/Repository/Process.php b/src/Core/Worker/Repository/Process.php index eb8fb07e32..b18a5b443d 100644 --- a/src/Core/Worker/Repository/Process.php +++ b/src/Core/Worker/Repository/Process.php @@ -112,7 +112,7 @@ class Process extends BaseRepository try { $processes = $this->db->select(static::$table_name, ['pid'], ['hostname' => $this->currentHost]); while ($process = $this->db->fetch($processes)) { - if (!posix_kill($process['pid'], 0)) { + if (!\posix_kill($process['pid'], 0)) { $this->db->delete(static::$table_name, ['pid' => $process['pid']]); } } From 8cf7743a2365f3c7bcda364229d152bfe86ac92e Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 16:29:46 +0200 Subject: [PATCH 03/17] Update composer.lock --- composer.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 3e8ec70de2..280e979e9e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c9e005c79c8556215c30a66c470659eb", + "content-hash": "456d14e3ad9be265c5c9e6172a0d18d8", "packages": [ { "name": "asika/simple-console", @@ -6474,6 +6474,7 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-openssl": "*", + "ext-posix": "*", "ext-simplexml": "*", "ext-xml": "*" }, From 1d328f4c769e85f53b9dd5a353a97f77564e4721 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 20:12:02 +0200 Subject: [PATCH 04/17] Adapt logging & temppath creation --- src/Core/System.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Core/System.php b/src/Core/System.php index b31e611998..d706e74d4c 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -523,19 +523,18 @@ class System * Checks if a given directory is usable for the system * * @param $directory - * @param bool $check_writable * * @return boolean the directory is usable */ - private static function isDirectoryUsable($directory, $check_writable = true) + private static function isDirectoryUsable($directory): bool { - if ($directory == '') { + if (empty($directory)) { Logger::warning('Directory is empty. This shouldn\'t happen.'); return false; } if (!file_exists($directory)) { - Logger::warning('Path does not exist', ['directory' => $directory, 'user' => static::getUser()]); + Logger::info('Path does not exist', ['directory' => $directory, 'user' => static::getUser()]); return false; } @@ -549,7 +548,7 @@ class System return false; } - if ($check_writable && !is_writable($directory)) { + if (!is_writable($directory)) { Logger::warning('Path is not writable', ['directory' => $directory, 'user' => static::getUser()]); return false; } @@ -601,7 +600,7 @@ class System $new_temppath = $temppath . "/" . DI::baseUrl()->getHost(); if (!is_dir($new_temppath)) { /// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method? - mkdir($new_temppath); + @mkdir($new_temppath); } if (self::isDirectoryUsable($new_temppath)) { From e6a8da68cd91984e0f58b322eda20864e8082433 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 21:52:02 +0200 Subject: [PATCH 05/17] Use new codecov uploader --- .woodpecker/.phpunit.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index cd9fea3500..d3730cff84 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -71,20 +71,26 @@ pipeline: else phpunit --configuration tests/phpunit.xml; fi - codecov: - image: plugins/codecov + image: friendicaci/codecov when: matrix: PHP_MAJOR_VERSION: 7.4 PHP_VERSION: 7.4.33 repo: - friendica/friendica - settings: - token: - from_secret: codecov-token - files: - - clover.xml + commands: + - curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import + - curl -Os https://uploader.codecov.io/latest/alpine/codecov + - curl -Os https://uploader.codecov.io/latest/alpine/codecov.SHA256SUM + - curl -Os https://uploader.codecov.io/latest/alpine/codecov.SHA256SUM.sig + - gpgv codecov.SHA256SUM.sig codecov.SHA256SUM + - shasum -a 256 -c codecov.SHA256SUM + - chmod +x codecov + - ./codecov -B ${CI_COMMIT_BRANCH} -C ${CI_COMMIT_SHA} -P ${CI_COMMIT_PULL_REQUEST} -b ${CI_PIPELINE_NUMBER} -Z -f 'clover.xml' + secrets: + - source: codecov-token + target: codecov_token services: mariadb: From 8a96f0fee410e42ed14c37e2f20fd292e766dcaf Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 21:54:51 +0200 Subject: [PATCH 06/17] Remove unnecessary code .. --- .woodpecker/.phpunit.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index d3730cff84..e4661a91e8 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -80,14 +80,7 @@ pipeline: repo: - friendica/friendica commands: - - curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import - - curl -Os https://uploader.codecov.io/latest/alpine/codecov - - curl -Os https://uploader.codecov.io/latest/alpine/codecov.SHA256SUM - - curl -Os https://uploader.codecov.io/latest/alpine/codecov.SHA256SUM.sig - - gpgv codecov.SHA256SUM.sig codecov.SHA256SUM - - shasum -a 256 -c codecov.SHA256SUM - - chmod +x codecov - - ./codecov -B ${CI_COMMIT_BRANCH} -C ${CI_COMMIT_SHA} -P ${CI_COMMIT_PULL_REQUEST} -b ${CI_PIPELINE_NUMBER} -Z -f 'clover.xml' + - codecov -B ${CI_COMMIT_BRANCH} -C ${CI_COMMIT_SHA} -P ${CI_COMMIT_PULL_REQUEST} -b ${CI_PIPELINE_NUMBER} -Z -f 'clover.xml' secrets: - source: codecov-token target: codecov_token From a88cc1ff845c171024631c9904a6dd4840cb4715 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 22:00:57 +0200 Subject: [PATCH 07/17] adapt parameters --- .woodpecker/.phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml index e4661a91e8..aee7fd384d 100644 --- a/.woodpecker/.phpunit.yml +++ b/.woodpecker/.phpunit.yml @@ -80,7 +80,7 @@ pipeline: repo: - friendica/friendica commands: - - codecov -B ${CI_COMMIT_BRANCH} -C ${CI_COMMIT_SHA} -P ${CI_COMMIT_PULL_REQUEST} -b ${CI_PIPELINE_NUMBER} -Z -f 'clover.xml' + - codecov -R '.' -Z -f 'clover.xml' secrets: - source: codecov-token target: codecov_token From 97e897a9caf0dabe143af93619b437f07088315d Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 23:00:43 +0200 Subject: [PATCH 08/17] Update System.php --- src/Core/System.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/System.php b/src/Core/System.php index d706e74d4c..00bdcd455c 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -526,7 +526,7 @@ class System * * @return boolean the directory is usable */ - private static function isDirectoryUsable($directory): bool + private static function isDirectoryUsable(string $directory): bool { if (empty($directory)) { Logger::warning('Directory is empty. This shouldn\'t happen.'); From 83212252fdbd0b5c016b104b1a7e31cf3bdd8484 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 20:40:54 +0200 Subject: [PATCH 09/17] Make likes singular/plural translatable --- src/Content/Conversation.php | 111 ++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 0bdc414c50..517aa0fe14 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -193,6 +193,28 @@ class Conversation } } + private function getLikers(array $likers): string + { + if (empty($likers)) { + return $this->l10n->t('Nobody'); + } + + $total = count($likers); + if ($total === 1) { + return $likers[0]; + } else { + if ($total < $this->config->get('system', 'max_likers')) { + $likerString = implode(', ', array_slice($likers, 0, -1)); + $likerString .= ' ' . $this->l10n->t('and') . ' ' . $likers[count($likers) - 1]; + } else { + $likerString = implode(', ', array_slice($likers, 0, $this->config->get('system', 'max_likers') - 1)); + $likerString .= ' ' . $this->l10n->t('and %d other people', $total - $this->config->get('system', 'max_likers')); + } + + return $likerString; + } + } + /** * Format the activity text for an item/photo/video * @@ -205,87 +227,70 @@ class Conversation public function formatActivity(array $links, string $verb, int $id): string { $this->profiler->startRecording('rendering'); - $o = ''; $expanded = ''; $phrase = ''; - $total = count($links); - if ($total == 1) { - $likers = $links[0]; + $likers = $this->getLikers($links); + $total = count($links); + + switch ($verb) { + case 'like': + $phrase = $this->l10n->tt('%2$s likes this.', '%2$s like this.', $total, $likers); + break; + case 'dislike': + $phrase = $this->l10n->tt('%2$s doesn\'t like this.', '%2$s don\'t like this.', $total, $likers); + break; + case 'attendyes': + $phrase = $this->l10n->tt('%2$s attends.', '%2$s attend.', $total, $likers); + break; + case 'attendno': + $phrase = $this->l10n->tt('%2$s doesn\'t attend.', '%2$s don\'t attend.', $total, $likers); + break; + case 'attendmaybe': + $phrase = $this->l10n->tt('%2$s attends maybe.', '%2$s attend maybe.', $total, $likers); + break; + case 'announce': + $phrase = $this->l10n->tt('%2$s reshared this.', '%2$s reshared this.', $total, $likers); + break; + } + + if ($total > 1) { + $spanatts = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\""; + $explikers = $phrase; - // Phrase if there is only one liker. In other cases it will be uses for the expanded - // list which show all likers switch ($verb) { case 'like': - $phrase = $this->l10n->t('%s likes this.', $likers); + $phrase = $this->l10n->t(' like this', $spanatts, $total); break; case 'dislike': - $phrase = $this->l10n->t('%s doesn\'t like this.', $likers); + $phrase = $this->l10n->t(' don\'t like this', $spanatts, $total); break; case 'attendyes': - $phrase = $this->l10n->t('%s attends.', $likers); + $phrase = $this->l10n->t(' attend', $spanatts, $total); break; case 'attendno': - $phrase = $this->l10n->t('%s doesn\'t attend.', $likers); + $phrase = $this->l10n->t(' don\'t attend', $spanatts, $total); break; case 'attendmaybe': - $phrase = $this->l10n->t('%s attends maybe.', $likers); + $phrase = $this->l10n->t(' attend maybe', $spanatts, $total); break; case 'announce': - $phrase = $this->l10n->t('%s reshared this.', $likers); - break; - } - } elseif ($total > 1) { - if ($total < $this->config->get('system', 'max_likers')) { - $likers = implode(', ', array_slice($links, 0, -1)); - $likers .= ' ' . $this->l10n->t('and') . ' ' . $links[count($links) - 1]; - } else { - $likers = implode(', ', array_slice($links, 0, $this->config->get('system', 'max_likers') - 1)); - $likers .= ' ' . $this->l10n->t('and %d other people', $total - $this->config->get('system', 'max_likers')); - } - - $spanatts = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\""; - - $explikers = ''; - switch ($verb) { - case 'like': - $phrase = $this->l10n->t(' like this', $spanatts, $total); - $explikers = $this->l10n->t('%s like this.', $likers); - break; - case 'dislike': - $phrase = $this->l10n->t(' don\'t like this', $spanatts, $total); - $explikers = $this->l10n->t('%s don\'t like this.', $likers); - break; - case 'attendyes': - $phrase = $this->l10n->t(' attend', $spanatts, $total); - $explikers = $this->l10n->t('%s attend.', $likers); - break; - case 'attendno': - $phrase = $this->l10n->t(' don\'t attend', $spanatts, $total); - $explikers = $this->l10n->t('%s don\'t attend.', $likers); - break; - case 'attendmaybe': - $phrase = $this->l10n->t(' attend maybe', $spanatts, $total); - $explikers = $this->l10n->t('%s attend maybe.', $likers); - break; - case 'announce': - $phrase = $this->l10n->t(' reshared this', $spanatts, $total); - $explikers = $this->l10n->t('%s reshared this.', $likers); + $phrase = $this->l10n->t(' reshared this', $spanatts, $total); break; } $expanded .= "\t" . ''; } - $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [ + $output = Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [ '$phrase' => $phrase, '$type' => $verb, '$id' => $id ]); - $o .= $expanded; + $output .= $expanded; $this->profiler->stopRecording(); - return $o; + return $output; } public function statusEditor(array $x = [], int $notes_cid = 0, bool $popup = false): string From 4ce6721c2745a801fbae81d50dcade436925949c Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 1 Apr 2023 20:49:38 +0200 Subject: [PATCH 10/17] Extract liker phrase in own method --- src/Content/Conversation.php | 65 +++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 517aa0fe14..47b4bb3051 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -41,6 +41,7 @@ use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; use Friendica\Model\Verb; +use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Object\Post as PostObject; use Friendica\Object\Thread; use Friendica\Protocol\Activity; @@ -193,15 +194,24 @@ class Conversation } } - private function getLikers(array $likers): string + /** + * Returns the liker phrase based on a list of likers + * + * @param string $verb the activity verb + * @param array $likers a list of likers + * + * @return string the liker phrase + * + * @throws InternalServerErrorException in case either the verb is invalid or the list of likers is empty + */ + private function getLikerPhrase(string $verb, array $likers): string { - if (empty($likers)) { - return $this->l10n->t('Nobody'); - } - $total = count($likers); - if ($total === 1) { - return $likers[0]; + + if ($total === 0) { + throw new InternalServerErrorException(sprintf('There has to be at least one Liker for verb "%s"', $verb)); + } else if ($total === 1) { + $likerString = $likers[0]; } else { if ($total < $this->config->get('system', 'max_likers')) { $likerString = implode(', ', array_slice($likers, 0, -1)); @@ -210,8 +220,23 @@ class Conversation $likerString = implode(', ', array_slice($likers, 0, $this->config->get('system', 'max_likers') - 1)); $likerString .= ' ' . $this->l10n->t('and %d other people', $total - $this->config->get('system', 'max_likers')); } + } - return $likerString; + switch ($verb) { + case 'like': + return $this->l10n->tt('%2$s likes this.', '%2$s like this.', $total, $likerString); + case 'dislike': + return $this->l10n->tt('%2$s doesn\'t like this.', '%2$s don\'t like this.', $total, $likerString); + case 'attendyes': + return $this->l10n->tt('%2$s attends.', '%2$s attend.', $total, $likerString); + case 'attendno': + return $this->l10n->tt('%2$s doesn\'t attend.', '%2$s don\'t attend.', $total, $likerString); + case 'attendmaybe': + return $this->l10n->tt('%2$s attends maybe.', '%2$s attend maybe.', $total, $likerString); + case 'announce': + return $this->l10n->tt('%2$s reshared this.', '%2$s reshared this.', $total, $likerString); + default: + throw new InternalServerErrorException(sprintf('Unknown verb "%s"', $verb)); } } @@ -228,32 +253,10 @@ class Conversation { $this->profiler->startRecording('rendering'); $expanded = ''; - $phrase = ''; - $likers = $this->getLikers($links); + $phrase = $this->getLikerPhrase($verb, $links); $total = count($links); - switch ($verb) { - case 'like': - $phrase = $this->l10n->tt('%2$s likes this.', '%2$s like this.', $total, $likers); - break; - case 'dislike': - $phrase = $this->l10n->tt('%2$s doesn\'t like this.', '%2$s don\'t like this.', $total, $likers); - break; - case 'attendyes': - $phrase = $this->l10n->tt('%2$s attends.', '%2$s attend.', $total, $likers); - break; - case 'attendno': - $phrase = $this->l10n->tt('%2$s doesn\'t attend.', '%2$s don\'t attend.', $total, $likers); - break; - case 'attendmaybe': - $phrase = $this->l10n->tt('%2$s attends maybe.', '%2$s attend maybe.', $total, $likers); - break; - case 'announce': - $phrase = $this->l10n->tt('%2$s reshared this.', '%2$s reshared this.', $total, $likers); - break; - } - if ($total > 1) { $spanatts = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\""; $explikers = $phrase; From 47802fbebd1f25f6d83dba7168c3801e18399d03 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 2 Apr 2023 11:34:08 +0200 Subject: [PATCH 11/17] Make more strings plural :) --- src/Content/Conversation.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 47b4bb3051..458a0a690f 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -263,22 +263,22 @@ class Conversation switch ($verb) { case 'like': - $phrase = $this->l10n->t(' like this', $spanatts, $total); + $phrase = $this->l10n->tt(' likes this', ' like this', $total, $spanatts); break; case 'dislike': - $phrase = $this->l10n->t(' don\'t like this', $spanatts, $total); + $phrase = $this->l10n->tt(' doesn\'t like this', ' don\'t like this', $total, $spanatts); break; case 'attendyes': - $phrase = $this->l10n->t(' attend', $spanatts, $total); + $phrase = $this->l10n->tt(' attends', ' attend', $total, $spanatts); break; case 'attendno': - $phrase = $this->l10n->t(' don\'t attend', $spanatts, $total); + $phrase = $this->l10n->tt(' doesn\'t attend',' don\'t attend', $total, $spanatts); break; case 'attendmaybe': - $phrase = $this->l10n->t(' attend maybe', $spanatts, $total); + $phrase = $this->l10n->tt(' attends maybe', ' attend maybe', $total, $spanatts); break; case 'announce': - $phrase = $this->l10n->t(' reshared this', $spanatts, $total); + $phrase = $this->l10n->tt(' reshared this', ' reshared this', $total, $spanatts); break; } From 808842e65846d95c593088ce83f7e9e5f5422794 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 2 Apr 2023 11:34:29 +0200 Subject: [PATCH 12/17] Updates messages.po --- view/lang/C/messages.po | 370 ++++++++++++++++++++-------------------- 1 file changed, 187 insertions(+), 183 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index d4641d5647..872de8db1f 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-rc\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-03-28 17:42+0000\n" +"POT-Creation-Date: 2023-04-02 09:34+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -50,8 +50,8 @@ msgstr "" #: src/Module/BaseNotifications.php:98 src/Module/BaseSettings.php:52 #: src/Module/Calendar/Event/API.php:88 src/Module/Calendar/Event/Form.php:84 #: src/Module/Calendar/Export.php:82 src/Module/Calendar/Show.php:82 -#: src/Module/Contact/Advanced.php:60 src/Module/Contact/Follow.php:86 -#: src/Module/Contact/Follow.php:159 src/Module/Contact/MatchInterests.php:86 +#: src/Module/Contact/Advanced.php:60 src/Module/Contact/Follow.php:87 +#: src/Module/Contact/Follow.php:160 src/Module/Contact/MatchInterests.php:86 #: src/Module/Contact/Suggestions.php:54 src/Module/Contact/Unfollow.php:66 #: src/Module/Contact/Unfollow.php:80 src/Module/Contact/Unfollow.php:112 #: src/Module/Delegation.php:118 src/Module/FollowConfirm.php:38 @@ -281,7 +281,7 @@ msgstr "" msgid "Your message:" msgstr "" -#: mod/message.php:200 mod/message.php:355 src/Content/Conversation.php:352 +#: mod/message.php:200 mod/message.php:355 src/Content/Conversation.php:360 #: src/Module/Post/Edit.php:131 msgid "Upload photo" msgstr "" @@ -292,7 +292,7 @@ msgid "Insert web link" msgstr "" #: mod/message.php:202 mod/message.php:358 mod/photos.php:1291 -#: src/Content/Conversation.php:381 src/Content/Conversation.php:725 +#: src/Content/Conversation.php:389 src/Content/Conversation.php:733 #: src/Module/Item/Compose.php:204 src/Module/Post/Edit.php:145 #: src/Module/Profile/UnkMail.php:154 src/Object/Post.php:545 msgid "Please wait" @@ -475,7 +475,7 @@ msgstr "" msgid "Do not show a status post for this upload" msgstr "" -#: mod/photos.php:733 mod/photos.php:1093 src/Content/Conversation.php:383 +#: mod/photos.php:733 mod/photos.php:1093 src/Content/Conversation.php:391 #: src/Module/Calendar/Event/Form.php:253 src/Module/Post/Edit.php:182 msgid "Permissions" msgstr "" @@ -488,8 +488,8 @@ msgstr "" msgid "Delete Album" msgstr "" -#: mod/photos.php:798 mod/photos.php:899 src/Content/Conversation.php:399 -#: src/Module/Contact/Follow.php:172 src/Module/Contact/Revoke.php:109 +#: mod/photos.php:798 mod/photos.php:899 src/Content/Conversation.php:407 +#: src/Module/Contact/Follow.php:173 src/Module/Contact/Revoke.php:109 #: src/Module/Contact/Unfollow.php:126 #: src/Module/Media/Attachment/Browser.php:77 #: src/Module/Media/Photo/Browser.php:88 src/Module/Post/Edit.php:167 @@ -606,22 +606,22 @@ msgid "Comment" msgstr "" #: mod/photos.php:1139 mod/photos.php:1195 mod/photos.php:1269 -#: src/Content/Conversation.php:396 src/Module/Calendar/Event/Form.php:248 +#: src/Content/Conversation.php:404 src/Module/Calendar/Event/Form.php:248 #: src/Module/Item/Compose.php:199 src/Module/Post/Edit.php:165 #: src/Object/Post.php:1069 msgid "Preview" msgstr "" -#: mod/photos.php:1140 src/Content/Conversation.php:351 +#: mod/photos.php:1140 src/Content/Conversation.php:359 #: src/Module/Post/Edit.php:130 src/Object/Post.php:1059 msgid "Loading..." msgstr "" -#: mod/photos.php:1226 src/Content/Conversation.php:641 src/Object/Post.php:256 +#: mod/photos.php:1226 src/Content/Conversation.php:649 src/Object/Post.php:256 msgid "Select" msgstr "" -#: mod/photos.php:1227 src/Content/Conversation.php:642 +#: mod/photos.php:1227 src/Content/Conversation.php:650 #: src/Module/Moderation/Users/Active.php:136 #: src/Module/Moderation/Users/Blocked.php:136 #: src/Module/Moderation/Users/Index.php:151 @@ -1064,355 +1064,359 @@ msgstr "" msgid "%s (via %s)" msgstr "" -#: src/Content/Conversation.php:220 -#, php-format -msgid "%s likes this." -msgstr "" - -#: src/Content/Conversation.php:223 -#, php-format -msgid "%s doesn't like this." -msgstr "" - -#: src/Content/Conversation.php:226 -#, php-format -msgid "%s attends." -msgstr "" - -#: src/Content/Conversation.php:229 -#, php-format -msgid "%s doesn't attend." -msgstr "" - -#: src/Content/Conversation.php:232 -#, php-format -msgid "%s attends maybe." -msgstr "" - -#: src/Content/Conversation.php:235 src/Content/Conversation.php:273 -#: src/Content/Conversation.php:885 -#, php-format -msgid "%s reshared this." -msgstr "" - -#: src/Content/Conversation.php:241 +#: src/Content/Conversation.php:218 msgid "and" msgstr "" -#: src/Content/Conversation.php:244 +#: src/Content/Conversation.php:221 #, php-format msgid "and %d other people" msgstr "" -#: src/Content/Conversation.php:252 +#: src/Content/Conversation.php:227 #, php-format -msgid " like this" -msgstr "" +msgid "%2$s likes this." +msgid_plural "%2$s like this." +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:253 +#: src/Content/Conversation.php:229 #, php-format -msgid "%s like this." -msgstr "" +msgid "%2$s doesn't like this." +msgid_plural "%2$s don't like this." +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:256 +#: src/Content/Conversation.php:231 #, php-format -msgid " don't like this" -msgstr "" +msgid "%2$s attends." +msgid_plural "%2$s attend." +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:257 +#: src/Content/Conversation.php:233 #, php-format -msgid "%s don't like this." -msgstr "" +msgid "%2$s doesn't attend." +msgid_plural "%2$s don't attend." +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:260 +#: src/Content/Conversation.php:235 #, php-format -msgid " attend" -msgstr "" +msgid "%2$s attends maybe." +msgid_plural "%2$s attend maybe." +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:261 +#: src/Content/Conversation.php:237 #, php-format -msgid "%s attend." -msgstr "" +msgid "%2$s reshared this." +msgid_plural "%2$s reshared this." +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:264 +#: src/Content/Conversation.php:266 #, php-format -msgid " don't attend" -msgstr "" - -#: src/Content/Conversation.php:265 -#, php-format -msgid "%s don't attend." -msgstr "" - -#: src/Content/Conversation.php:268 -#, php-format -msgid " attend maybe" -msgstr "" +msgid " likes this" +msgid_plural " like this" +msgstr[0] "" +msgstr[1] "" #: src/Content/Conversation.php:269 #, php-format -msgid "%s attend maybe." -msgstr "" +msgid " doesn't like this" +msgid_plural "" +" don't like this" +msgstr[0] "" +msgstr[1] "" #: src/Content/Conversation.php:272 #, php-format -msgid " reshared this" -msgstr "" +msgid " attends" +msgid_plural " attend" +msgstr[0] "" +msgstr[1] "" -#: src/Content/Conversation.php:320 +#: src/Content/Conversation.php:275 +#, php-format +msgid " doesn't attend" +msgid_plural " don't attend" +msgstr[0] "" +msgstr[1] "" + +#: src/Content/Conversation.php:278 +#, php-format +msgid " attends maybe" +msgid_plural " attend maybe" +msgstr[0] "" +msgstr[1] "" + +#: src/Content/Conversation.php:281 +#, php-format +msgid " reshared this" +msgid_plural " reshared this" +msgstr[0] "" +msgstr[1] "" + +#: src/Content/Conversation.php:328 msgid "Visible to everybody" msgstr "" -#: src/Content/Conversation.php:321 src/Module/Item/Compose.php:198 +#: src/Content/Conversation.php:329 src/Module/Item/Compose.php:198 #: src/Object/Post.php:1068 msgid "Please enter a image/video/audio/webpage URL:" msgstr "" -#: src/Content/Conversation.php:322 +#: src/Content/Conversation.php:330 msgid "Tag term:" msgstr "" -#: src/Content/Conversation.php:323 src/Module/Filer/SaveTag.php:73 +#: src/Content/Conversation.php:331 src/Module/Filer/SaveTag.php:73 msgid "Save to Folder:" msgstr "" -#: src/Content/Conversation.php:324 +#: src/Content/Conversation.php:332 msgid "Where are you right now?" msgstr "" -#: src/Content/Conversation.php:325 +#: src/Content/Conversation.php:333 msgid "Delete item(s)?" msgstr "" -#: src/Content/Conversation.php:337 src/Module/Item/Compose.php:175 +#: src/Content/Conversation.php:345 src/Module/Item/Compose.php:175 msgid "Created at" msgstr "" -#: src/Content/Conversation.php:347 +#: src/Content/Conversation.php:355 msgid "New Post" msgstr "" -#: src/Content/Conversation.php:350 +#: src/Content/Conversation.php:358 msgid "Share" msgstr "" -#: src/Content/Conversation.php:353 src/Module/Post/Edit.php:132 +#: src/Content/Conversation.php:361 src/Module/Post/Edit.php:132 msgid "upload photo" msgstr "" -#: src/Content/Conversation.php:354 src/Module/Post/Edit.php:133 +#: src/Content/Conversation.php:362 src/Module/Post/Edit.php:133 msgid "Attach file" msgstr "" -#: src/Content/Conversation.php:355 src/Module/Post/Edit.php:134 +#: src/Content/Conversation.php:363 src/Module/Post/Edit.php:134 msgid "attach file" msgstr "" -#: src/Content/Conversation.php:356 src/Module/Item/Compose.php:190 +#: src/Content/Conversation.php:364 src/Module/Item/Compose.php:190 #: src/Module/Post/Edit.php:171 src/Object/Post.php:1060 msgid "Bold" msgstr "" -#: src/Content/Conversation.php:357 src/Module/Item/Compose.php:191 +#: src/Content/Conversation.php:365 src/Module/Item/Compose.php:191 #: src/Module/Post/Edit.php:172 src/Object/Post.php:1061 msgid "Italic" msgstr "" -#: src/Content/Conversation.php:358 src/Module/Item/Compose.php:192 +#: src/Content/Conversation.php:366 src/Module/Item/Compose.php:192 #: src/Module/Post/Edit.php:173 src/Object/Post.php:1062 msgid "Underline" msgstr "" -#: src/Content/Conversation.php:359 src/Module/Item/Compose.php:193 +#: src/Content/Conversation.php:367 src/Module/Item/Compose.php:193 #: src/Module/Post/Edit.php:174 src/Object/Post.php:1063 msgid "Quote" msgstr "" -#: src/Content/Conversation.php:360 src/Module/Item/Compose.php:194 +#: src/Content/Conversation.php:368 src/Module/Item/Compose.php:194 #: src/Module/Post/Edit.php:175 src/Object/Post.php:1064 msgid "Code" msgstr "" -#: src/Content/Conversation.php:361 src/Module/Item/Compose.php:195 +#: src/Content/Conversation.php:369 src/Module/Item/Compose.php:195 #: src/Object/Post.php:1065 msgid "Image" msgstr "" -#: src/Content/Conversation.php:362 src/Module/Item/Compose.php:196 +#: src/Content/Conversation.php:370 src/Module/Item/Compose.php:196 #: src/Module/Post/Edit.php:176 src/Object/Post.php:1066 msgid "Link" msgstr "" -#: src/Content/Conversation.php:363 src/Module/Item/Compose.php:197 +#: src/Content/Conversation.php:371 src/Module/Item/Compose.php:197 #: src/Module/Post/Edit.php:177 src/Object/Post.php:1067 msgid "Link or Media" msgstr "" -#: src/Content/Conversation.php:364 +#: src/Content/Conversation.php:372 msgid "Video" msgstr "" -#: src/Content/Conversation.php:365 src/Module/Item/Compose.php:200 +#: src/Content/Conversation.php:373 src/Module/Item/Compose.php:200 #: src/Module/Post/Edit.php:141 msgid "Set your location" msgstr "" -#: src/Content/Conversation.php:366 src/Module/Post/Edit.php:142 +#: src/Content/Conversation.php:374 src/Module/Post/Edit.php:142 msgid "set location" msgstr "" -#: src/Content/Conversation.php:367 src/Module/Post/Edit.php:143 +#: src/Content/Conversation.php:375 src/Module/Post/Edit.php:143 msgid "Clear browser location" msgstr "" -#: src/Content/Conversation.php:368 src/Module/Post/Edit.php:144 +#: src/Content/Conversation.php:376 src/Module/Post/Edit.php:144 msgid "clear location" msgstr "" -#: src/Content/Conversation.php:370 src/Module/Item/Compose.php:205 +#: src/Content/Conversation.php:378 src/Module/Item/Compose.php:205 #: src/Module/Post/Edit.php:157 msgid "Set title" msgstr "" -#: src/Content/Conversation.php:372 src/Module/Item/Compose.php:206 +#: src/Content/Conversation.php:380 src/Module/Item/Compose.php:206 #: src/Module/Post/Edit.php:159 msgid "Categories (comma-separated list)" msgstr "" -#: src/Content/Conversation.php:377 src/Module/Item/Compose.php:222 +#: src/Content/Conversation.php:385 src/Module/Item/Compose.php:222 msgid "Scheduled at" msgstr "" -#: src/Content/Conversation.php:382 src/Module/Post/Edit.php:146 +#: src/Content/Conversation.php:390 src/Module/Post/Edit.php:146 msgid "Permission settings" msgstr "" -#: src/Content/Conversation.php:392 src/Module/Post/Edit.php:155 +#: src/Content/Conversation.php:400 src/Module/Post/Edit.php:155 msgid "Public post" msgstr "" -#: src/Content/Conversation.php:406 src/Content/Widget/VCard.php:113 +#: src/Content/Conversation.php:414 src/Content/Widget/VCard.php:113 #: src/Model/Profile.php:469 src/Module/Admin/Logs/View.php:92 #: src/Module/Post/Edit.php:180 msgid "Message" msgstr "" -#: src/Content/Conversation.php:407 src/Module/Post/Edit.php:181 +#: src/Content/Conversation.php:415 src/Module/Post/Edit.php:181 #: src/Module/Settings/TwoFactor/Trusted.php:140 msgid "Browser" msgstr "" -#: src/Content/Conversation.php:409 src/Module/Post/Edit.php:184 +#: src/Content/Conversation.php:417 src/Module/Post/Edit.php:184 msgid "Open Compose page" msgstr "" -#: src/Content/Conversation.php:669 src/Object/Post.php:243 +#: src/Content/Conversation.php:677 src/Object/Post.php:243 msgid "Pinned item" msgstr "" -#: src/Content/Conversation.php:685 src/Object/Post.php:491 +#: src/Content/Conversation.php:693 src/Object/Post.php:491 #: src/Object/Post.php:492 #, php-format msgid "View %s's profile @ %s" msgstr "" -#: src/Content/Conversation.php:698 src/Object/Post.php:479 +#: src/Content/Conversation.php:706 src/Object/Post.php:479 msgid "Categories:" msgstr "" -#: src/Content/Conversation.php:699 src/Object/Post.php:480 +#: src/Content/Conversation.php:707 src/Object/Post.php:480 msgid "Filed under:" msgstr "" -#: src/Content/Conversation.php:707 src/Object/Post.php:505 +#: src/Content/Conversation.php:715 src/Object/Post.php:505 #, php-format msgid "%s from %s" msgstr "" -#: src/Content/Conversation.php:723 +#: src/Content/Conversation.php:731 msgid "View in context" msgstr "" -#: src/Content/Conversation.php:788 +#: src/Content/Conversation.php:796 msgid "remove" msgstr "" -#: src/Content/Conversation.php:792 +#: src/Content/Conversation.php:800 msgid "Delete Selected Items" msgstr "" -#: src/Content/Conversation.php:857 src/Content/Conversation.php:860 -#: src/Content/Conversation.php:863 src/Content/Conversation.php:866 +#: src/Content/Conversation.php:865 src/Content/Conversation.php:868 +#: src/Content/Conversation.php:871 src/Content/Conversation.php:874 #, php-format msgid "You had been addressed (%s)." msgstr "" -#: src/Content/Conversation.php:869 +#: src/Content/Conversation.php:877 #, php-format msgid "You are following %s." msgstr "" -#: src/Content/Conversation.php:872 +#: src/Content/Conversation.php:880 msgid "You subscribed to one or more tags in this post." msgstr "" -#: src/Content/Conversation.php:887 +#: src/Content/Conversation.php:893 +#, php-format +msgid "%s reshared this." +msgstr "" + +#: src/Content/Conversation.php:895 msgid "Reshared" msgstr "" -#: src/Content/Conversation.php:887 +#: src/Content/Conversation.php:895 #, php-format msgid "Reshared by %s <%s>" msgstr "" -#: src/Content/Conversation.php:890 +#: src/Content/Conversation.php:898 #, php-format msgid "%s is participating in this thread." msgstr "" -#: src/Content/Conversation.php:893 +#: src/Content/Conversation.php:901 msgid "Stored for general reasons" msgstr "" -#: src/Content/Conversation.php:896 +#: src/Content/Conversation.php:904 msgid "Global post" msgstr "" -#: src/Content/Conversation.php:899 +#: src/Content/Conversation.php:907 msgid "Sent via an relay server" msgstr "" -#: src/Content/Conversation.php:899 +#: src/Content/Conversation.php:907 #, php-format msgid "Sent via the relay server %s <%s>" msgstr "" -#: src/Content/Conversation.php:902 +#: src/Content/Conversation.php:910 msgid "Fetched" msgstr "" -#: src/Content/Conversation.php:902 +#: src/Content/Conversation.php:910 #, php-format msgid "Fetched because of %s <%s>" msgstr "" -#: src/Content/Conversation.php:905 +#: src/Content/Conversation.php:913 msgid "Stored because of a child post to complete this thread." msgstr "" -#: src/Content/Conversation.php:908 +#: src/Content/Conversation.php:916 msgid "Local delivery" msgstr "" -#: src/Content/Conversation.php:911 +#: src/Content/Conversation.php:919 msgid "Stored because of your activity (like, comment, star, ...)" msgstr "" -#: src/Content/Conversation.php:914 +#: src/Content/Conversation.php:922 msgid "Distributed" msgstr "" -#: src/Content/Conversation.php:917 +#: src/Content/Conversation.php:925 msgid "Pushed to us" msgstr "" @@ -1623,7 +1627,7 @@ msgstr "" #: src/Content/Item.php:438 src/Content/Widget.php:80 #: src/Model/Contact.php:1199 src/Model/Contact.php:1210 -#: src/Module/Contact/Follow.php:166 view/theme/vier/theme.php:196 +#: src/Module/Contact/Follow.php:167 view/theme/vier/theme.php:196 msgid "Connect/Follow" msgstr "" @@ -3275,89 +3279,89 @@ msgstr "" msgid "Upcoming events the next 7 days:" msgstr "" -#: src/Model/Profile.php:873 +#: src/Model/Profile.php:875 #, php-format msgid "OpenWebAuth: %1$s welcomes %2$s" msgstr "" -#: src/Model/Profile.php:1013 +#: src/Model/Profile.php:1015 msgid "Hometown:" msgstr "" -#: src/Model/Profile.php:1014 +#: src/Model/Profile.php:1016 msgid "Marital Status:" msgstr "" -#: src/Model/Profile.php:1015 +#: src/Model/Profile.php:1017 msgid "With:" msgstr "" -#: src/Model/Profile.php:1016 +#: src/Model/Profile.php:1018 msgid "Since:" msgstr "" -#: src/Model/Profile.php:1017 +#: src/Model/Profile.php:1019 msgid "Sexual Preference:" msgstr "" -#: src/Model/Profile.php:1018 +#: src/Model/Profile.php:1020 msgid "Political Views:" msgstr "" -#: src/Model/Profile.php:1019 +#: src/Model/Profile.php:1021 msgid "Religious Views:" msgstr "" -#: src/Model/Profile.php:1020 +#: src/Model/Profile.php:1022 msgid "Likes:" msgstr "" -#: src/Model/Profile.php:1021 +#: src/Model/Profile.php:1023 msgid "Dislikes:" msgstr "" -#: src/Model/Profile.php:1022 +#: src/Model/Profile.php:1024 msgid "Title/Description:" msgstr "" -#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:221 +#: src/Model/Profile.php:1025 src/Module/Admin/Summary.php:221 #: src/Module/Moderation/Summary.php:77 msgid "Summary" msgstr "" -#: src/Model/Profile.php:1024 +#: src/Model/Profile.php:1026 msgid "Musical interests" msgstr "" -#: src/Model/Profile.php:1025 +#: src/Model/Profile.php:1027 msgid "Books, literature" msgstr "" -#: src/Model/Profile.php:1026 +#: src/Model/Profile.php:1028 msgid "Television" msgstr "" -#: src/Model/Profile.php:1027 +#: src/Model/Profile.php:1029 msgid "Film/dance/culture/entertainment" msgstr "" -#: src/Model/Profile.php:1028 +#: src/Model/Profile.php:1030 msgid "Hobbies/Interests" msgstr "" -#: src/Model/Profile.php:1029 +#: src/Model/Profile.php:1031 msgid "Love/romance" msgstr "" -#: src/Model/Profile.php:1030 +#: src/Model/Profile.php:1032 msgid "Work/employment" msgstr "" -#: src/Model/Profile.php:1031 +#: src/Model/Profile.php:1033 msgid "School/education" msgstr "" -#: src/Model/Profile.php:1032 +#: src/Model/Profile.php:1034 msgid "Contact information and Social Networks" msgstr "" @@ -5852,28 +5856,28 @@ msgstr "" msgid "No common contacts." msgstr "" -#: src/Module/Contact/Contacts.php:115 src/Module/Profile/Contacts.php:132 +#: src/Module/Contact/Contacts.php:115 src/Module/Profile/Contacts.php:135 #, php-format msgid "Follower (%s)" msgid_plural "Followers (%s)" msgstr[0] "" msgstr[1] "" -#: src/Module/Contact/Contacts.php:119 src/Module/Profile/Contacts.php:135 +#: src/Module/Contact/Contacts.php:119 src/Module/Profile/Contacts.php:138 #, php-format msgid "Following (%s)" msgid_plural "Following (%s)" msgstr[0] "" msgstr[1] "" -#: src/Module/Contact/Contacts.php:123 src/Module/Profile/Contacts.php:138 +#: src/Module/Contact/Contacts.php:123 src/Module/Profile/Contacts.php:141 #, php-format msgid "Mutual friend (%s)" msgid_plural "Mutual friends (%s)" msgstr[0] "" msgstr[1] "" -#: src/Module/Contact/Contacts.php:125 src/Module/Profile/Contacts.php:140 +#: src/Module/Contact/Contacts.php:125 src/Module/Profile/Contacts.php:143 #, php-format msgid "These contacts both follow and are followed by %s." msgstr "" @@ -5892,14 +5896,14 @@ msgid "" "contacts (follow, comment or likes on public posts)." msgstr "" -#: src/Module/Contact/Contacts.php:139 src/Module/Profile/Contacts.php:146 +#: src/Module/Contact/Contacts.php:139 src/Module/Profile/Contacts.php:149 #, php-format msgid "Contact (%s)" msgid_plural "Contacts (%s)" msgstr[0] "" msgstr[1] "" -#: src/Module/Contact/Follow.php:69 src/Module/Contact/Redir.php:62 +#: src/Module/Contact/Follow.php:70 src/Module/Contact/Redir.php:62 #: src/Module/Contact/Redir.php:222 src/Module/Conversation/Community.php:194 #: src/Module/Debug/ItemBody.php:38 src/Module/Diaspora/Receive.php:57 #: src/Module/Item/Display.php:96 src/Module/Item/Feed.php:59 @@ -5909,36 +5913,36 @@ msgstr[1] "" msgid "Access denied." msgstr "" -#: src/Module/Contact/Follow.php:104 src/Module/Contact/Unfollow.php:125 +#: src/Module/Contact/Follow.php:105 src/Module/Contact/Unfollow.php:125 #: src/Module/Profile/RemoteFollow.php:133 msgid "Submit Request" msgstr "" -#: src/Module/Contact/Follow.php:114 +#: src/Module/Contact/Follow.php:115 msgid "You already added this contact." msgstr "" -#: src/Module/Contact/Follow.php:129 +#: src/Module/Contact/Follow.php:130 msgid "The network type couldn't be detected. Contact can't be added." msgstr "" -#: src/Module/Contact/Follow.php:137 +#: src/Module/Contact/Follow.php:138 msgid "Diaspora support isn't enabled. Contact can't be added." msgstr "" -#: src/Module/Contact/Follow.php:142 +#: src/Module/Contact/Follow.php:143 msgid "OStatus support is disabled. Contact can't be added." msgstr "" -#: src/Module/Contact/Follow.php:167 src/Module/Profile/RemoteFollow.php:132 +#: src/Module/Contact/Follow.php:168 src/Module/Profile/RemoteFollow.php:132 msgid "Please answer the following:" msgstr "" -#: src/Module/Contact/Follow.php:168 src/Module/Contact/Unfollow.php:123 +#: src/Module/Contact/Follow.php:169 src/Module/Contact/Unfollow.php:123 msgid "Your Identity Address:" msgstr "" -#: src/Module/Contact/Follow.php:169 src/Module/Contact/Profile.php:375 +#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:375 #: src/Module/Contact/Unfollow.php:129 #: src/Module/Moderation/Blocklist/Contact.php:133 #: src/Module/Notifications/Introductions.php:129 @@ -5946,26 +5950,26 @@ msgstr "" msgid "Profile URL" msgstr "" -#: src/Module/Contact/Follow.php:170 src/Module/Contact/Profile.php:387 +#: src/Module/Contact/Follow.php:171 src/Module/Contact/Profile.php:387 #: src/Module/Notifications/Introductions.php:191 #: src/Module/Profile/Profile.php:234 msgid "Tags:" msgstr "" -#: src/Module/Contact/Follow.php:181 +#: src/Module/Contact/Follow.php:182 #, php-format msgid "%s knows you" msgstr "" -#: src/Module/Contact/Follow.php:182 +#: src/Module/Contact/Follow.php:183 msgid "Add a personal note:" msgstr "" -#: src/Module/Contact/Follow.php:191 src/Module/Contact/Unfollow.php:138 +#: src/Module/Contact/Follow.php:192 src/Module/Contact/Unfollow.php:138 msgid "Posts and Replies" msgstr "" -#: src/Module/Contact/Follow.php:220 +#: src/Module/Contact/Follow.php:221 msgid "The contact could not be added." msgstr "" @@ -8260,7 +8264,7 @@ msgstr "" msgid "Remove" msgstr "" -#: src/Module/Profile/Contacts.php:156 +#: src/Module/Profile/Contacts.php:159 msgid "No contacts." msgstr "" @@ -11433,12 +11437,12 @@ msgstr "" msgid "Login failed. Please check your credentials." msgstr "" -#: src/Security/Authentication.php:389 +#: src/Security/Authentication.php:391 #, php-format msgid "Welcome %s" msgstr "" -#: src/Security/Authentication.php:390 +#: src/Security/Authentication.php:392 msgid "Please upload a profile photo." msgstr "" From 09f95597694a1a55a3eb9e226de67cbd2410aa4b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 2 Apr 2023 23:19:40 -0400 Subject: [PATCH 13/17] Reformat Factory\Api\Mastodon\Status - Simplify boolean operations - Add ACLFormatter dependency to constructor - Fix white space alignment --- src/Factory/Api/Mastodon/Status.php | 28 +++++++++++-------- .../Mastodon/Status/FriendicaExtension.php | 18 ++++++------ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index aa9a6fb882..41f02090e0 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -39,6 +39,7 @@ use Friendica\Object\Api\Mastodon\Status\FriendicaExtension; use Friendica\Object\Api\Mastodon\Status\FriendicaVisibility; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityPub; +use Friendica\Util\ACLFormatter; use ImagickException; use Psr\Log\LoggerInterface; @@ -62,6 +63,8 @@ class Status extends BaseFactory private $mstdnPollFactory; /** @var ContentItem */ private $contentItem; + /** @var ACLFormatter */ + private $aclFormatter; public function __construct( LoggerInterface $logger, @@ -73,7 +76,8 @@ class Status extends BaseFactory Attachment $mstdnAttachmentFactory, Error $mstdnErrorFactory, Poll $mstdnPollFactory, - ContentItem $contentItem + ContentItem $contentItem, + ACLFormatter $aclFormatter ) { parent::__construct($logger); $this->dba = $dba; @@ -85,6 +89,7 @@ class Status extends BaseFactory $this->mstdnErrorFactory = $mstdnErrorFactory; $this->mstdnPollFactory = $mstdnPollFactory; $this->contentItem = $contentItem; + $this->aclFormatter = $aclFormatter; } /** @@ -169,7 +174,7 @@ class Status extends BaseFactory $count_dislike ); - $origin_like = ($count_like == 0) ? false : Post::exists([ + $origin_like = $count_like > 0 && Post::exists([ 'thr-parent-id' => $uriId, 'uid' => $uid, 'origin' => true, @@ -177,7 +182,7 @@ class Status extends BaseFactory 'vid' => Verb::getID(Activity::LIKE), 'deleted' => false ]); - $origin_dislike = ($count_dislike == 0) ? false : Post::exists([ + $origin_dislike = $count_dislike > 0 && Post::exists([ 'thr-parent-id' => $uriId, 'uid' => $uid, 'origin' => true, @@ -185,7 +190,7 @@ class Status extends BaseFactory 'vid' => Verb::getID(Activity::DISLIKE), 'deleted' => false ]); - $origin_announce = ($count_announce == 0) ? false : Post::exists([ + $origin_announce = $count_announce > 0 && (Post::exists([ 'thr-parent-id' => $uriId, 'uid' => $uid, 'origin' => true, @@ -194,16 +199,16 @@ class Status extends BaseFactory 'deleted' => false ]) || Post::exists([ 'quote-uri-id' => $uriId, - 'uid' => $uid, - 'origin' => true, - 'body' => '', - 'deleted' => false - ]); + 'uid' => $uid, + 'origin' => true, + 'body' => '', + 'deleted' => false + ])); $userAttributes = new \Friendica\Object\Api\Mastodon\Status\UserAttributes( $origin_like, $origin_announce, Post\ThreadUser::getIgnored($uriId, $uid), - (bool)($item['starred'] && ($item['gravity'] == Item::GRAVITY_PARENT)), + $item['starred'] && $item['gravity'] == Item::GRAVITY_PARENT, $item['featured'] ); @@ -300,9 +305,8 @@ class Status extends BaseFactory $in_reply = []; } - $aclFormatter = DI::aclFormatter(); $delivery_data = $uid != $item['uid'] ? null : new FriendicaDeliveryData($item['delivery_queue_count'], $item['delivery_queue_done'], $item['delivery_queue_failed']); - $visibility_data = $uid != $item['uid'] ? null : new FriendicaVisibility($aclFormatter->expand($item['allow_cid']), $aclFormatter->expand($item['deny_cid']), $aclFormatter->expand($item['allow_gid']), $aclFormatter->expand($item['deny_gid'])); + $visibility_data = $uid != $item['uid'] ? null : new FriendicaVisibility($this->aclFormatter->expand($item['allow_cid']), $this->aclFormatter->expand($item['deny_cid']), $this->aclFormatter->expand($item['allow_gid']), $this->aclFormatter->expand($item['deny_gid'])); $friendica = new FriendicaExtension($item['title'], $item['changed'], $item['commented'], $item['received'], $counts->dislikes, $origin_dislike, $delivery_data, $visibility_data); return new \Friendica\Object\Api\Mastodon\Status($item, $account, $counts, $userAttributes, $sensitive, $application, $mentions, $tags, $card, $attachments, $in_reply, $reshare, $friendica, $quote, $poll); diff --git a/src/Object/Api/Mastodon/Status/FriendicaExtension.php b/src/Object/Api/Mastodon/Status/FriendicaExtension.php index e00399a9b7..b204fc530d 100644 --- a/src/Object/Api/Mastodon/Status/FriendicaExtension.php +++ b/src/Object/Api/Mastodon/Status/FriendicaExtension.php @@ -62,15 +62,15 @@ class FriendicaExtension extends BaseDataTransferObject /** * Creates a FriendicaExtension object * - * @param string $title - * @param string|null $changed_at - * @param string|null $commented_at - * @param string|null $edited_at - * @param string|null $received_at - * @param int $dislikes_count - * @param bool $disliked - * @param FriendicaDeliveryData|null $delivery_data - * @param FriendicaVisibility|null $visibility + * @param string $title + * @param ?string $changed_at + * @param ?string $commented_at + * @param ?string $received_at + * @param int $dislikes_count + * @param bool $disliked + * @param ?FriendicaDeliveryData $delivery_data + * @param ?FriendicaVisibility $visibility + * @throws \Exception */ public function __construct( string $title, From 888f5439d3d2b5beb2ee81bd18c4cc182398bac4 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 2 Apr 2023 23:22:19 -0400 Subject: [PATCH 14/17] Account for null title when instantiating FriendicaExtension in Factory\Api\Mastodon\Status --- src/Factory/Api/Mastodon/Status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index 41f02090e0..c331590b55 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -307,7 +307,7 @@ class Status extends BaseFactory $delivery_data = $uid != $item['uid'] ? null : new FriendicaDeliveryData($item['delivery_queue_count'], $item['delivery_queue_done'], $item['delivery_queue_failed']); $visibility_data = $uid != $item['uid'] ? null : new FriendicaVisibility($this->aclFormatter->expand($item['allow_cid']), $this->aclFormatter->expand($item['deny_cid']), $this->aclFormatter->expand($item['allow_gid']), $this->aclFormatter->expand($item['deny_gid'])); - $friendica = new FriendicaExtension($item['title'], $item['changed'], $item['commented'], $item['received'], $counts->dislikes, $origin_dislike, $delivery_data, $visibility_data); + $friendica = new FriendicaExtension($item['title'] ?? '', $item['changed'], $item['commented'], $item['received'], $counts->dislikes, $origin_dislike, $delivery_data, $visibility_data); return new \Friendica\Object\Api\Mastodon\Status($item, $account, $counts, $userAttributes, $sensitive, $application, $mentions, $tags, $card, $attachments, $in_reply, $reshare, $friendica, $quote, $poll); } From c673c478eec1889a4ddc0fa0036d8b1764dcf1e3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 3 Apr 2023 00:03:32 -0400 Subject: [PATCH 15/17] Ward against missing plink in createSharedBlockByArray - Address https://github.com/friendica/friendica/issues/12486#issuecomment-1492984224 - Add logging to troubleshoot the issue --- src/Model/Item.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index af47b643cf..5ba8ae1bf2 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3042,7 +3042,11 @@ class Item } if (!empty($quote_uri_id)) { - $item['body'] .= "\n" . DI::contentItem()->createSharedBlockByArray($shared_item); + if (isset($shared_item['plink'])) { + $item['body'] .= "\n" . DI::contentItem()->createSharedBlockByArray($shared_item); + } else { + DI::logger()->warning('Missing plink in shared item', ['item' => $item, 'shared' => $shared, 'quote_uri_id' => $quote_uri_id, 'shared_item' => $shared_item]); + } } if (!empty($shared_item['uri-id'])) { From e7628af15ff4cf50ba23c064dacd610618ffdd5d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 3 Apr 2023 00:05:40 -0400 Subject: [PATCH 16/17] Ward against nonexistant item in Item::prepareBody - Address https://github.com/friendica/friendica/issues/12486#issuecomment-1492984392 --- src/Model/Item.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Model/Item.php b/src/Model/Item.php index 5ba8ae1bf2..aa33418599 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -31,6 +31,7 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityPub; use Friendica\Protocol\Delivery; @@ -1394,10 +1395,16 @@ class Item * * @param integer $uri_id * @return void + * @throws InternalServerErrorException + * @throws \ImagickException */ public static function updateDisplayCache(int $uri_id) { $item = Post::selectFirst(self::DISPLAY_FIELDLIST, ['uri-id' => $uri_id]); + if (!$item) { + return; + } + self::prepareBody($item, false, false, true); } From 9c375e64602b449b02a0eff8355583d530b02cac Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 3 Apr 2023 18:42:41 +0200 Subject: [PATCH 17/17] Fix DateTimeFormat issue --- src/Util/DateTimeFormat.php | 4 ++-- tests/src/Util/DateTimeFormatTest.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Util/DateTimeFormat.php b/src/Util/DateTimeFormat.php index df7b6d92c4..e8b3482620 100644 --- a/src/Util/DateTimeFormat.php +++ b/src/Util/DateTimeFormat.php @@ -182,8 +182,8 @@ class DateTimeFormat */ public static function fix(string $dateString): string { - $search = ['Mär', 'März', 'Mai', 'Juni', 'Juli', 'Okt', 'Dez', 'ET' , 'ZZ', ' - ', '+', '&#43;', ' (Coordinated Universal Time)']; - $replace = ['Mar', 'Mar' , 'May', 'Jun' , 'Jul' , 'Oct', 'Dec', 'EST', 'Z' , ', ' , '+' , '+' , '']; + $search = ['Mär', 'März', 'Mai', 'Juni', 'Juli', 'Okt', 'Dez', 'ET' , 'ZZ', ' - ', '+', '&#43;', ' (Coordinated Universal Time)', '\\']; + $replace = ['Mar', 'Mar' , 'May', 'Jun' , 'Jul' , 'Oct', 'Dec', 'EST', 'Z' , ', ' , '+' , '+' , '' , '']; $dateString = str_replace($search, $replace, $dateString); diff --git a/tests/src/Util/DateTimeFormatTest.php b/tests/src/Util/DateTimeFormatTest.php index c4e2127bad..046680de62 100644 --- a/tests/src/Util/DateTimeFormatTest.php +++ b/tests/src/Util/DateTimeFormatTest.php @@ -134,7 +134,11 @@ class DateTimeFormatTest extends MockedTest 'Double HTML encode' => [ 'expectedDate' => '2015-05-22T08:48:00+12:00', 'dateString' => '2015-05-22T08:48:00&#43;12:00' - ] + ], + '2023-04-02\T17:22:42+05:30' => [ + 'expectedDate' => '2023-04-02T17:22:42+05:30', + 'dateString' => '2023-04-02\T17:22:42+05:30' + ], ]; }