mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 06:55:19 +00:00
Merge branch 'dev' of /home/macgirvin/z into dev
This commit is contained in:
commit
10a3b33dac
2 changed files with 20 additions and 4 deletions
|
@ -2738,7 +2738,7 @@ class Activity {
|
|||
|
||||
}
|
||||
|
||||
static function rewrite_mentions_sub(&$s, $pref) {
|
||||
static function rewrite_mentions_sub(&$s, $pref, &$obj = null) {
|
||||
|
||||
if ($s['term']) {
|
||||
foreach ($s['term'] as $tag) {
|
||||
|
@ -2795,6 +2795,20 @@ class Activity {
|
|||
'@[zrl=' . $x[0]['xchan_url'] . ']' . $txt . '[/zrl]',$s['body']);
|
||||
$s['body'] = preg_replace('/\[url\=' . preg_quote($x[0]['xchan_hash'],'/') . '\]@(.*?)\[\/url\]/ism',
|
||||
'@[url=' . $x[0]['xchan_url'] . ']' . $txt . '[/url]',$s['body']);
|
||||
|
||||
if ($obj) {
|
||||
if (! is_array($obj)) {
|
||||
$obj = json_decode($obj,true);
|
||||
}
|
||||
if (array_path_exists('source/content',$obj)) {
|
||||
$obj['source']['content'] = preg_replace('/\@\[zrl\=' . preg_quote($x[0]['xchan_url'],'/') . '\](.*?)\[\/zrl\]/ism',
|
||||
'@[zrl=' . $x[0]['xchan_url'] . ']' . $txt . '[/zrl]',$obj['source']['content']);
|
||||
$obj['source']['content'] = preg_replace('/\@\[url\=' . preg_quote($x[0]['xchan_url'],'/') . '\](.*?)\[\/url\]/ism',
|
||||
'@[url=' . $x[0]['xchan_url'] . ']' . $txt . '[/url]',$obj['source']['content']);
|
||||
}
|
||||
$obj['content'] = preg_replace('/\@(.*?)\<a (.*?)href\=\"' . preg_quote($x[0]['xchan_url'],'/') . '\"(.*?)\>(.*?)\<\/a\>/ism',
|
||||
'@$1<a $2 href="' . $x[0]['xchan_url'] . '"$3>' . $txt . '</a>', $obj['content']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,9 +92,11 @@ class ActivityPub {
|
|||
// only cause confusion on nomadic networks where there could be any number
|
||||
// of applicable webfinger addresses for a given identity.
|
||||
|
||||
Activity::rewrite_mentions_sub($target_item, 1);
|
||||
|
||||
Activity::rewrite_mentions_sub($target_item, 1, $target_item['obj']);
|
||||
|
||||
$ti = Activity::encode_activity($target_item, true);
|
||||
|
||||
if (! $ti) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue