diff options
author | Aaron Parecki <aaron@parecki.com> | 2016-12-29 06:42:36 -0800 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2016-12-29 06:42:36 -0800 |
commit | 07d0e958fdce4091b7b4fbc071fea42af2f5df12 (patch) | |
tree | 7c96678751b6be376c04ead594c67be3536ea054 /controllers/controllers.php | |
parent | 90256b538547c68367f6711ae706d75495e92d19 (diff) |
clean up mentions list
Diffstat (limited to 'controllers/controllers.php')
-rw-r--r-- | controllers/controllers.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/controllers/controllers.php b/controllers/controllers.php index 2e6f1e0..8ffaedb 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -444,16 +444,18 @@ $app->get('/reply/preview', function() use($app) { if($entry) { if(array_key_exists('author', $entry)) { // Find all @-names in the post, as well as the author name - $mentions[] = $entry['author']['nickname']; + $mentions[] = strtolower($entry['author']['nickname']); } if(preg_match_all('/(^|(?<=[\s\/]))@([a-z0-9_]+([a-z0-9_\.]*)?)/i', $entry['content']['text'], $matches)) { foreach($matches[0] as $nick) { if(trim($nick,'@') != $user->twitter_username && trim($nick,'@') != display_url($user->url)) - $mentions[] = trim($nick,'@'); + $mentions[] = strtolower(trim($nick,'@')); } } + $mentions = array_values(array_unique($mentions)); + } $app->response()['Content-type'] = 'application/json'; |