Skip to content

Commit

Permalink
Merge branch 'v3'
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelthomas2774 committed Aug 28, 2019
2 parents b098701 + 42747d2 commit e3f9802
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Providers/Discord/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Discord extends OAuth implements UserProfilesInterface, UserPicturesInterf
'MANAGE_NICKNAMES' => 0x08000000,
'MANAGE_ROLES' => 0x10000000,
'MANAGE_WEBHOOKS' => 0x20000000,
'MANAGE_EMOJIS' => 0x40000000
'MANAGE_EMOJIS' => 0x40000000,
];

/**
Expand All @@ -101,7 +101,8 @@ public function getUserProfile(): UserProfile
$user->response = $response;
$user->username = $response->username . '#' . $response->discriminator;
$user->name = $response->username;
$user->email_addresses = [$response->email];
$user->email_addresses = [];
if (isset($response->email)) array_push($user->email_addresses, $response->email);

return $user;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Providers/GitLab/GitLab.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public function getUserPictureUrl(int $size = 50): ?string

if (!isset($response->avatar_url)) return null;

return $response->avatar_url . ($size ? '&size=' . $size : '');
return $response->avatar_url .
($size ? (strpos($response->avatar_url, '?') !== false ? '&' : '?') . 'size=' . $size : '');
}
}
2 changes: 1 addition & 1 deletion src/Providers/Mastodon/Mastodon.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Mastodon extends OAuth implements UserProfilesInterface, UserPicturesInter
*
* @var string
*/
public $base_api_endpoint = 'https://mastodon.social';
public $base_api_endpoint = 'https://mastodon.social/api/v1/';

/**
* OAuth 2.0 authorise endpoint.
Expand Down
2 changes: 1 addition & 1 deletion src/TokenEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function createAccessTokenFromSuccessfulResponse(stdClass $response, a
$refresh_token = isset($response->refresh_token) ? $response->refresh_token : null;
$expires = isset($response->expires_in) ? time() + $response->expires_in : null;
$scope = !isset($response->scope) ? $requested_scope :
strlen($response->scope) === 0 ? [] : explode($this->scope_separator, $response->scope);
(strlen($response->scope) === 0 ? [] : explode($this->scope_separator, $response->scope));

$token = new AccessToken($response->access_token, $refresh_token, $expires, $scope);
$token->response = $response;
Expand Down

0 comments on commit e3f9802

Please sign in to comment.