Skip to content

Commit

Permalink
Ajout de BlueSky sur les profils Speaker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mopolo committed Jan 27, 2025
1 parent 764cb73 commit 33f1dcb
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/Resources/views/admin/speaker/edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{{ form_row(form.biography) }}
{{ form_row(form.twitter) }}
{{ form_row(form.mastodon) }}
{{ form_row(form.bluesky) }}
{{ form_row(form.referent_person) }}
{{ form_row(form.referent_person_email) }}
{{ form_row(form.twitter) }}
Expand Down
10 changes: 10 additions & 0 deletions app/Resources/views/blog/speakers.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
<span>Suivre @{{ row.speaker.getUsernameMastodon }}</span>
</a>
{% endif %}
{% if row.speaker.bluesky %}
<a class="follow-button"
href="{{ row.speaker.urlBluesky }}"
target="_blank">
<svg width="12" viewBox="0 0 512 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M111.8 62.2C170.2 105.9 233 194.7 256 242.4c23-47.6 85.8-136.4 144.2-180.2c42.1-31.6 110.3-56 110.3 21.8c0 15.5-8.9 130.5-14.1 149.2C478.2 298 412 314.6 353.1 304.5c102.9 17.5 129.1 75.5 72.5 133.5c-107.4 110.2-154.3-27.6-166.3-62.9l0 0c-1.7-4.9-2.6-7.8-3.3-7.8s-1.6 3-3.3 7.8l0 0c-12 35.3-59 173.1-166.3 62.9c-56.5-58-30.4-116 72.5-133.5C100 314.6 33.8 298 15.7 233.1C10.4 214.4 1.5 99.4 1.5 83.9c0-77.8 68.2-53.4 110.3-21.8z"/>
</svg>
<span>Suivre @{{ row.speaker.bluesky }}</span>
</a>
{% endif %}
<div class="article-body conferencier">
<div class="photo">
<img src="{{ app.request.getSchemeAndHttpHost() }}{{ photo_storage.getUrl(row.speaker) }}" alt="{{ row.speaker.label }}">
Expand Down
12 changes: 12 additions & 0 deletions db/migrations/20250127123553_speaker_bluesky.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php


use Phinx\Migration\AbstractMigration;

class SpeakerBluesky extends AbstractMigration
{
public function change()
{
$this->query("ALTER TABLE afup_conferenciers ADD bluesky varchar(255) DEFAULT NULL AFTER mastodon");
}
}
4 changes: 3 additions & 1 deletion db/seeds/Conferenciers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function run()
'biographie' => 'Président 2018-2019 de l\'AFUP',
'twitter' => 'ubermuda',
'mastodon' => 'https://phpc.social/@ubermuda',
'bluesky' => 'afup.org',
'user_github' => GithubUsers::ID_GITHUBUSER_UBERMUDA,
'photo' => '1968.jpg',
'will_attend_speakers_diner' => null,
Expand All @@ -40,6 +41,7 @@ public function run()
'biographie' => 'Bio Adrien',
'twitter' => 'agallou',
'mastodon' => 'https://phpc.social/@agallou',
'bluesky' => 'lyon.afup.org',
'user_github' => 2,
'photo' => '1968.jpg',
'will_attend_speakers_diner' => null,
Expand All @@ -57,4 +59,4 @@ public function run()
->save()
;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function __invoke(Request $request)
$speaker->setLastname($data->lastname);
$speaker->setBiography($data->biography);
$speaker->setTwitter($data->twitter);
$speaker->setBluesky($data->bluesky);
$speaker->setMastodon($data->mastodon);
$speaker->setEmail($data->email);
$speaker->setUser($data->githubUser !== null ? $data->githubUser->getId() : null);
Expand Down
3 changes: 3 additions & 0 deletions sources/AppBundle/Event/Form/SpeakerFormData.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class SpeakerFormData
* @var string
*/
public $mastodon;

public ?string $bluesky = null;

/**
* @Assert\File(mimeTypes={"image/jpeg","image/png"})
* @var UploadedFile|null
Expand Down
4 changes: 2 additions & 2 deletions sources/AppBundle/Event/Form/SpeakerFormDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class SpeakerFormDataFactory
{
public function fromSpeaker(Speaker $speaker)
public function fromSpeaker(Speaker $speaker): SpeakerFormData
{
$data = new SpeakerFormData();
$data->civility = $speaker->getCivility();
Expand All @@ -18,12 +18,12 @@ public function fromSpeaker(Speaker $speaker)
$data->biography = $speaker->getBiography();
$data->twitter = $speaker->getTwitter();
$data->mastodon = $speaker->getMastodon();
$data->bluesky = $speaker->getBluesky();
$data->githubUser = $speaker->getUser();
$data->phoneNumber = $speaker->getPhoneNumber();
$data->referentPerson = $speaker->getReferentPerson();
$data->referentPersonEmail = $speaker->getReferentPersonEmail();


return $data;
}
}
2 changes: 2 additions & 0 deletions sources/AppBundle/Event/Form/SpeakerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->add('biography', TextareaType::class)
->add('twitter', TextType::class, ['required' => false])
->add('mastodon', UrlType::class, ['required' => false, 'help' => 'Exemple https://mastodon.online/@afup', 'default_protocol' => 'https'])
->add('bluesky', TextType::class, ['required' => false, 'help' => 'Exemple acme.bsky.social'])
;

if (true === $options[self::OPT_USER_GITHUB]) {
Expand Down Expand Up @@ -104,6 +105,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$speaker->setBiography($previousSpeakerInfos->getBiography());
$speaker->setTwitter($previousSpeakerInfos->getTwitter());
$speaker->setMastodon($previousSpeakerInfos->getMastodon());
$speaker->setBluesky($previousSpeakerInfos->getBluesky());
$speaker->setPhoto($previousSpeakerInfos->getPhoto());

$formEvent->getForm()->add('isFromPreviousEvent', HiddenType::class, ['mapped' => false]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getScheduledSpeakersByEvent(Event $event, $returnTalksThatWillBe
}

$query = $this->getPreparedQuery('SELECT speaker.conferencier_id, speaker.id_forum, speaker.civilite, speaker.nom, speaker.prenom, speaker.email, speaker.societe,
speaker.biographie, speaker.twitter, speaker.mastodon, speaker.user_github, speaker.photo, talk.titre, talk.session_id,
speaker.biographie, speaker.twitter, speaker.mastodon, speaker.bluesky, speaker.user_github, speaker.photo, talk.titre, talk.session_id,
speaker.will_attend_speakers_diner,
speaker.has_special_diet,
speaker.referent_person,
Expand Down Expand Up @@ -255,6 +255,11 @@ public static function initMetadata(SerializerFactoryInterface $serializerFactor
'fieldName' => 'mastodon',
'type' => 'string'
])
->addField([
'columnName' => 'bluesky',
'fieldName' => 'bluesky',
'type' => 'string'
])
->addField([
'columnName' => 'user_github',
'fieldName' => 'user',
Expand Down
27 changes: 27 additions & 0 deletions sources/AppBundle/Event/Model/Speaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class Speaker implements NotifyPropertyInterface
*/
private $mastodon;

private ?string $bluesky = null;

/**
* @var GithubUser
*/
Expand Down Expand Up @@ -402,6 +404,20 @@ public function getMastodon(): string
return (string) $this->mastodon;
}

public function getBluesky(): ?string
{
return $this->bluesky;
}

public function getUrlBluesky(): ?string
{
if ($this->bluesky === null) {
return null;
}

return 'https://bsky.app/profile/' . $this->bluesky;
}

public function getUsernameTwitter(): string
{
$twitter = $this->getTwitter();
Expand Down Expand Up @@ -473,6 +489,17 @@ public function setMastodon($mastodon)
return $this;
}

public function setBluesky(?string $bluesky): self
{
if ($bluesky !== null) {
$bluesky = str_replace('https://bsky.app/profile/', '', $bluesky);
}

$this->propertyChanged('bluesky', $this->bluesky, $bluesky);
$this->bluesky = $bluesky;
return $this;
}

/**
* @return GithubUser
*/
Expand Down

0 comments on commit 33f1dcb

Please sign in to comment.