mirror of
https://github.com/friendica/friendica
synced 2024-11-18 03:03:41 +00:00
OStatus replies should now work even if the thread starter isn't in the mentions.
This commit is contained in:
parent
788d3cf1ab
commit
d732d9d1a8
2 changed files with 40 additions and 13 deletions
|
@ -828,7 +828,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
$ev = bbtoevent($Text);
|
||||
|
||||
|
||||
// Replace any html brackets with HTML Entities to prevent executing HTML or script
|
||||
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
|
||||
|
||||
|
@ -885,8 +884,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
$MAILSearchString = $URLSearchString;
|
||||
|
||||
// Remove all hashtag addresses
|
||||
if (!$tryoembed OR $simplehtml)
|
||||
if ((!$tryoembed OR $simplehtml) AND ($simplehtml != 7))
|
||||
$Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
|
||||
elseif ($simplehtml == 7)
|
||||
$Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||
'$1<span class="vcard"><a href="$2" class="url" title="$3"><span class="fn nickname mention">$3</span></a></span>',
|
||||
$Text);
|
||||
|
||||
|
||||
// Bookmarks in red - will be converted to bookmarks in friendica
|
||||
$Text = preg_replace("/#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '[bookmark=$1]$1[/bookmark]', $Text);
|
||||
|
|
31
mod/item.php
31
mod/item.php
|
@ -144,6 +144,7 @@ function item_post(&$a) {
|
|||
$parent_contact["nurl"] = normalise_link($probed_contact["url"]);
|
||||
$parent_contact["thumb"] = $probed_contact["photo"];
|
||||
$parent_contact["micro"] = $probed_contact["photo"];
|
||||
$parent_contact["addr"] = $probed_contact["addr"];
|
||||
}
|
||||
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
|
||||
} else
|
||||
|
@ -569,10 +570,32 @@ function item_post(&$a) {
|
|||
* and we are replying, and there isn't one already
|
||||
*/
|
||||
|
||||
if(($parent_contact) && ($parent_contact['network'] === NETWORK_OSTATUS)
|
||||
&& ($parent_contact['nick']) && (!in_array('@'.$parent_contact['nick'].'+'.$parent_contact['id'],$tags))) {
|
||||
$body = '@'.$parent_contact['nick'].'+'.$parent_contact['id'].' '.$body;
|
||||
$tags[] = '@'.$parent_contact['nick'].'+'.$parent_contact['id'];
|
||||
if ($parent_contact['id'] != "")
|
||||
$contact = '@'.$parent_contact['nick'].'+'.$parent_contact['id'];
|
||||
//elseif ($parent_contact['addr'] != "")
|
||||
// $contact = '@'.$parent_contact['addr'];
|
||||
else
|
||||
$contact = '@[url='.$parent_contact['url'].']'.$parent_contact['nick'].'[/url]';
|
||||
|
||||
if ($parent_contact && ($parent_contact['network'] === NETWORK_OSTATUS)) {
|
||||
if (($parent_contact['nick']) && (!in_array($contact,$tags))) {
|
||||
$body = $contact.' '.$body;
|
||||
$tags[] = $contact;
|
||||
}
|
||||
|
||||
$toplevel_contact = "";
|
||||
$toplevel_parent = q("SELECT `contact`.* FROM `contact` INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id`
|
||||
WHERE `item`.`id` = `item`.`parent` AND `item`.`parent` = %d", intval($parent));
|
||||
if ($toplevel_parent)
|
||||
$toplevel_contact = '@'.$toplevel_parent[0]['nick'].'+'.$toplevel_parent[0]['id'];
|
||||
else {
|
||||
$toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent));
|
||||
$toplevel_contact = '@[url='.$toplevel_parent[0]['author-link'].']'.$toplevel_parent[0]['author-name'].'[/url]';
|
||||
}
|
||||
|
||||
if ($toplevel_contact != "")
|
||||
if (!in_array($toplevel_contact,$tags))
|
||||
$tags[] = $toplevel_contact;
|
||||
}
|
||||
|
||||
$tagged = array();
|
||||
|
|
Loading…
Reference in a new issue