[COMPONENT][Link] Ignore html anchors that include mention class
This commit is contained in:
parent
0d5e545a6e
commit
36483a6ecd
|
@ -41,7 +41,8 @@ class Link extends Component
|
||||||
{
|
{
|
||||||
if (Common::config('attachments', 'process_links')) {
|
if (Common::config('attachments', 'process_links')) {
|
||||||
$matched_urls = [];
|
$matched_urls = [];
|
||||||
preg_match_all($this->getURLRegex(), $content, $matched_urls);
|
// TODO: This solution to ignore mentions when content is in html is far from ideal
|
||||||
|
preg_match_all($this->getURLRegex(), preg_replace('#<a href="(.*?)" class="u-url mention">#', '', $content), $matched_urls);
|
||||||
$matched_urls = array_unique($matched_urls[1]);
|
$matched_urls = array_unique($matched_urls[1]);
|
||||||
foreach ($matched_urls as $match) {
|
foreach ($matched_urls as $match) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -90,7 +90,7 @@ class Note extends Model
|
||||||
{
|
{
|
||||||
$handleInReplyTo = function (AbstractObject|string $type_note): ?int {
|
$handleInReplyTo = function (AbstractObject|string $type_note): ?int {
|
||||||
try {
|
try {
|
||||||
$parent_note = is_null($type_note->get('inReplyTo')) ? null : ActivityPub::getObjectByUri($type_note->get('inReplyTo'), try_online: true);
|
$parent_note = \is_null($type_note->get('inReplyTo')) ? null : ActivityPub::getObjectByUri($type_note->get('inReplyTo'), try_online: true);
|
||||||
if ($parent_note instanceof \App\Entity\Note) {
|
if ($parent_note instanceof \App\Entity\Note) {
|
||||||
return $parent_note->getId();
|
return $parent_note->getId();
|
||||||
} elseif ($parent_note instanceof Type\AbstractObject && $parent_note->get('type') === 'Note') {
|
} elseif ($parent_note instanceof Type\AbstractObject && $parent_note->get('type') === 'Note') {
|
||||||
|
@ -201,7 +201,7 @@ class Note extends Model
|
||||||
Conversation::assignLocalConversation($obj, $reply_to);
|
Conversation::assignLocalConversation($obj, $reply_to);
|
||||||
|
|
||||||
// Need file and note ids for the next step
|
// Need file and note ids for the next step
|
||||||
Event::handle('ProcessNoteContent', [$obj, $obj->getContent(), $obj->getContentType(), $process_note_content_extra_args = []]);
|
Event::handle('ProcessNoteContent', [$obj, $obj->getRendered(), $obj->getContentType(), $process_note_content_extra_args = []]);
|
||||||
|
|
||||||
if ($processed_attachments !== []) {
|
if ($processed_attachments !== []) {
|
||||||
foreach ($processed_attachments as [$a, $fname]) {
|
foreach ($processed_attachments as [$a, $fname]) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user