mirror of
https://github.com/friendica/friendica
synced 2025-04-28 21:44:22 +02:00
There is now a "content-warning" field
This commit is contained in:
parent
6352aa112b
commit
5bd519efff
6 changed files with 28 additions and 27 deletions
|
@ -604,6 +604,21 @@ class OStatus
|
|||
$item["coord"] = $georsspoint->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
$categories = $xpath->query('atom:category', $entry);
|
||||
if ($categories) {
|
||||
foreach ($categories as $category) {
|
||||
foreach ($category->attributes as $attributes) {
|
||||
if ($attributes->name == "term") {
|
||||
$term = $attributes->textContent;
|
||||
if (strlen($item["tag"])) {
|
||||
$item["tag"] .= ',';
|
||||
}
|
||||
$item["tag"] .= "#[url=".System::baseUrl()."/search?tag=".$term."]".$term."[/url]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$self = '';
|
||||
$add_body = '';
|
||||
|
||||
|
@ -643,12 +658,11 @@ class OStatus
|
|||
}
|
||||
|
||||
// Mastodon Content Warning
|
||||
$content_warning = false;
|
||||
if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
|
||||
$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
|
||||
if (!empty($clear_text)) {
|
||||
$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
|
||||
$content_warning = true;
|
||||
$item['content-warning'] = html2bbcode($clear_text);
|
||||
//$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -673,26 +687,6 @@ class OStatus
|
|||
$item["parent-uri"] = $item["uri"];
|
||||
}
|
||||
|
||||
$categories = $xpath->query('atom:category', $entry);
|
||||
if ($categories) {
|
||||
foreach ($categories as $category) {
|
||||
foreach ($category->attributes as $attributes) {
|
||||
if ($attributes->name == "term") {
|
||||
$term = $attributes->textContent;
|
||||
// don't add nsfw with content warning if enabled.
|
||||
// Background: "nsfw" is set automatically by Mastodon
|
||||
if (!Config::get('system', 'remove_nsfw_with_cw', false) ||
|
||||
!$content_warning || ($term != 'nsfw')) {
|
||||
if (strlen($item["tag"])) {
|
||||
$item["tag"] .= ',';
|
||||
}
|
||||
$item["tag"] .= "#[url=".System::baseUrl()."/search?tag=".$term."]".$term."[/url]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($item['author-link'] != '') && !empty($item['protocol'])) {
|
||||
$item = Conversation::insert($item);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue