Merge pull request #13670 from annando/exceptions

Fix exceptions in the channel check
This commit is contained in:
Hypolite Petovan 2023-11-25 16:59:21 -05:00 committed by GitHub
commit 56cfc57641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -87,9 +87,10 @@ class Engagement
$searchtext = self::getSearchTextForItem($parent);
if (!$store) {
$content = trim(($parent['title'] ?? '') . ' ' . ($parent['content-warning'] ?? '') . ' ' . ($parent['body'] ?? ''));
$language = array_key_first(Item::getLanguageArray($content, 1, 0, $parent['author-id']));
$store = DI::userDefinedChannel()->match($searchtext, $language);
$content = trim(($parent['title'] ?? '') . ' ' . ($parent['content-warning'] ?? '') . ' ' . ($parent['body'] ?? ''));
$languages = Item::getLanguageArray($content, 1, 0, $parent['author-id']);
$language = !empty($languages) ? array_key_first($languages) : '';
$store = DI::userDefinedChannel()->match($searchtext, $language);
}
$engagement = [

View File

@ -76,7 +76,7 @@ class Reports extends BaseModeration
while ($post = $this->database->fetch($posts)) {
if (in_array($post['rid'], array_keys($reports))) {
$post['created'] = DateTimeFormat::local($post['created'], DateTimeFormat::MYSQL);
$post['body'] = BBCode::toPlaintext($post['body']);
$post['body'] = BBCode::toPlaintext($post['body'] ?? '');
$reports[$post['rid']]['posts'][] = $post;
}

View File

@ -1749,7 +1749,8 @@ class Processor
}
$searchtext = Engagement::getSearchTextForActivity($content, $authorid, $messageTags, $receivers);
$language = array_key_first(Item::getLanguageArray($content, 1, 0, $authorid));
$languages = Item::getLanguageArray($content, 1, 0, $authorid);
$language = !empty($languages) ? array_key_first($languages) : '';
return DI::userDefinedChannel()->match($searchtext, $language);
}