Merge pull request #969 from pixelfed/frontend-ui-refactor

Update AP Helpers
pull/1005/head
daniel 2019-03-05 19:52:56 -07:00 zatwierdzone przez GitHub
commit e32368bd5c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -293,6 +293,14 @@ class Helpers {
public static function profileFirstOrNew($url, $runJobs = false)
{
$url = self::validateUrl($url);
$host = parse_url($url, PHP_URL_HOST);
$local = config('pixelfed.domain.app') == $host ? true : false;
if($local == true) {
$id = last(explode('/', $url));
return Profile::whereUsername($id)->firstOrFail();
}
$res = self::fetchProfileFromUrl($url);
$domain = parse_url($res['id'], PHP_URL_HOST);
$username = $res['preferredUsername'];