forked from friendica/friendica-addons
Twitter Issue 9692: Only append Twitter profile links as mentions
This commit is contained in:
parent
16588c41f6
commit
e1bbec52bf
1 changed files with 8 additions and 8 deletions
|
@ -557,7 +557,7 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
|
||||||
$orig_post = Item::selectFirst([], $condition);
|
$orig_post = Item::selectFirst(['author-nick', 'author-network'], $condition);
|
||||||
if (!DBA::isResult($orig_post)) {
|
if (!DBA::isResult($orig_post)) {
|
||||||
Logger::warning('No parent found', ['thr-parent' => $b["thr-parent"]]);
|
Logger::warning('No parent found', ['thr-parent' => $b["thr-parent"]]);
|
||||||
return;
|
return;
|
||||||
|
@ -565,14 +565,14 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
$iscomment = true;
|
$iscomment = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($orig_post['author-network'] == Protocol::TWITTER) {
|
||||||
|
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $orig_post["author-nick"] . "[/url]";
|
||||||
|
$nicknameplain = "@" . $orig_post["author-nick"];
|
||||||
|
|
||||||
$nicknameplain = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $orig_post["author-link"]);
|
Logger::info('Comparing', ['nickname' => $nickname, 'nicknameplain' => $nicknameplain, 'body' => $b["body"]]);
|
||||||
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
|
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
|
||||||
$nicknameplain = "@" . $nicknameplain;
|
$b["body"] = $nickname . " " . $b["body"];
|
||||||
|
}
|
||||||
Logger::info('Comparing', ['nickname' => $nickname, 'nicknameplain' => $nicknameplain, 'body' => $b["body"]]);
|
|
||||||
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
|
|
||||||
$b["body"] = $nickname . " " . $b["body"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::debug('Parent found', ['parent' => $orig_post]);
|
Logger::debug('Parent found', ['parent' => $orig_post]);
|
||||||
|
|
Loading…
Reference in a new issue