Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

afup#1285 speaker display mastodon link #1552

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stakovicz
Copy link
Contributor

@stakovicz stakovicz commented Nov 21, 2024

On récupère et affiche le lien vers mastodon s'il existe dans le profile du speaker.
Lié à la MR sur Event : afup/event#31 et cette issue : #1285

Comment on lines +424 to +436
public function getCleanedMastodon(): string
{
if (!strpos('@', $this->getMastodon())) {
return '';
}
list(,$username) = explode('@', $this->getMastodon());

if (trim($username) === '') {
return '';
}

return $username;
}
Copy link
Contributor

@vinceAmstoutz vinceAmstoutz Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peut être refactorisé en introduisant une variable. Sinon, tu ne renvoi pas le $username trim ?

Suggested change
public function getCleanedMastodon(): string
{
if (!strpos('@', $this->getMastodon())) {
return '';
}
list(,$username) = explode('@', $this->getMastodon());
if (trim($username) === '') {
return '';
}
return $username;
}
public function getCleanedMastodon(): string
{
$mastodon = $this->getMastodon();
if (strpos($mastodon, '@') === false) {
return '';
}
list(,$username) = explode('@', $mastodon);
if (trim($username) === '') {
return '';
}
return $username;
}

@stakovicz stakovicz self-assigned this Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants