Fix on speaker pic

Change-Id: I9c8d6516d33d01d536e86816294714f9bb1e633b
This commit is contained in:
smarcet
2019-04-30 15:09:44 -03:00
parent 7a57ac262b
commit c0b2758e4e
2 changed files with 4 additions and 4 deletions

View File

@@ -300,7 +300,7 @@ class PresentationSpeaker extends SilverstripeBaseModel
*/
public function getTwitterName()
{
return $this->twitter_name;
return urlencode($this->twitter_name);
}
/**
@@ -1608,10 +1608,10 @@ SQL;
if($this->hasPhoto() && $photo = $this->getPhoto()){
$photoUrl = $photo->getUrl();
}
if(empty($photo_url) && $this->hasMember() && $this->member->hasPhoto() && $photo = $this->member->getPhoto()){
if(empty($photoUrl) && $this->hasMember() && $this->member->hasPhoto() && $photo = $this->member->getPhoto()){
$photoUrl = $photo->getUrl();
}
if(empty($photo_url) && !empty($this->getTwitterName()) ){
if(empty($photoUrl) && !empty($this->getTwitterName()) ){
$twitterName = $this->getTwitterName();
$photoUrl = sprintf("https://avatars.io/twitter/%s", trim(trim($twitterName, '@')));
}

View File

@@ -408,7 +408,7 @@ final class OAuth2SpeakersApiTest extends ProtectedApiTest
public function testGetSpeaker(){
$params = [
'speaker_id' => 2884
'speaker_id' => 12927
];
$headers = [