Merge pull request 'Langfilter: Use two letter code for the language / Bluesky: Remove callstack' (#1430) from heluecht/friendica-addons:callstack-language into 2023.09-rc

Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1430
This commit is contained in:
Hypolite Petovan 2023-10-18 22:30:52 +02:00
commit c7e06bfa53
2 changed files with 3 additions and 4 deletions

View file

@ -32,7 +32,6 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -1235,7 +1234,7 @@ function bluesky_add_media(stdClass $embed, array $item, int $fetch_uid, int $le
function bluesky_get_uri(stdClass $post): string function bluesky_get_uri(stdClass $post): string
{ {
if (empty($post->cid)) { if (empty($post->cid)) {
Logger::info('Invalid URI', ['post' => $post, 'callstack' => System::callstack(10, 0, true)]); Logger::info('Invalid URI', ['post' => $post]);
return ''; return '';
} }
return $post->uri . ':' . $post->cid; return $post->uri . ':' . $post->cid;
@ -1337,7 +1336,7 @@ function bluesky_fetch_post(string $uri, int $uid): string
function bluesky_process_thread(stdClass $thread, int $uid, array $cdata, int $level): string function bluesky_process_thread(stdClass $thread, int $uid, array $cdata, int $level): string
{ {
if (empty($thread->post)) { if (empty($thread->post)) {
Logger::info('Invalid post', ['post' => $thread, 'callstack' => System::callstack(10, 0, true)]); Logger::info('Invalid post', ['post' => $thread]);
return ''; return '';
} }
$uri = bluesky_get_uri($thread->post); $uri = bluesky_get_uri($thread->post);

View file

@ -163,7 +163,7 @@ function langfilter_prepare_body_content_filter(&$hook_data)
return; return;
} }
$lang = $iso639->languageByCode1($iso2); $lang = $iso639->languageByCode1(substr($iso2, 0, 2));
} else { } else {
$opts = $hook_data['item']['postopts']; $opts = $hook_data['item']['postopts'];
if (!$opts) { if (!$opts) {