Merge pull request #6839 from MrPetovan/bug/6829-fix-implicit-mention-regex
Fix implicit mention regex
This commit is contained in:
commit
792a0f11c0
1 changed files with 1 additions and 27 deletions
|
@ -710,7 +710,7 @@ class Processor
|
||||||
$kept_mentions = [];
|
$kept_mentions = [];
|
||||||
|
|
||||||
// Extract one prepended mention at a time from the body
|
// Extract one prepended mention at a time from the body
|
||||||
while(preg_match('#^(@\[url=([^\]]+)].*?\[\/url]\s)(.*)#mis', $body, $matches)) {
|
while(preg_match('#^(@\[url=([^\]]+)].*?\[\/url]\s)(.*)#is', $body, $matches)) {
|
||||||
if (!in_array($matches[2], $potential_mentions) ) {
|
if (!in_array($matches[2], $potential_mentions) ) {
|
||||||
$kept_mentions[] = $matches[1];
|
$kept_mentions[] = $matches[1];
|
||||||
}
|
}
|
||||||
|
@ -743,30 +743,4 @@ class Processor
|
||||||
|
|
||||||
return $activity_tags;
|
return $activity_tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function testImplicitMentions($item, $source)
|
|
||||||
{
|
|
||||||
$parent = Item::selectFirst(['id', 'guid', 'author-link', 'alias'], ['uri' => $item['thr-parent']]);
|
|
||||||
|
|
||||||
$implicit_mentions = self::getImplicitMentionList($parent);
|
|
||||||
var_dump($implicit_mentions);
|
|
||||||
|
|
||||||
$object = json_decode($source, true)['object'];
|
|
||||||
var_dump($object);
|
|
||||||
|
|
||||||
$content = HTML::toBBCode($object['content']);
|
|
||||||
$content = self::convertMentions($content);
|
|
||||||
|
|
||||||
$activity = [
|
|
||||||
'tags' => $object['tag'],
|
|
||||||
'content' => $content
|
|
||||||
];
|
|
||||||
|
|
||||||
var_dump($activity);
|
|
||||||
|
|
||||||
$activity['content'] = Processor::removeImplicitMentionsFromBody($activity['content'], $implicit_mentions);
|
|
||||||
$activity['tags'] = Processor::convertImplicitMentionsInTags($activity['tags'], $implicit_mentions);
|
|
||||||
|
|
||||||
return $activity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue