diff --git a/server/services/tournament.ts b/server/services/tournament.ts index 6734f03b0..47f54e187 100644 --- a/server/services/tournament.ts +++ b/server/services/tournament.ts @@ -29,8 +29,27 @@ export async function findTournamentByNameForUrl({ }, }); - return tournaments.find( + const result = tournaments.find( (tournament) => tournament.organizer.nameForUrl === organizationNameForUrl.toLowerCase() ); + + if (!result) return result; + + result.organizer.twitter = twitterToUrl(result.organizer.twitter); + result.organizer.discordInvite = discordInviteToUrl( + result.organizer.discordInvite + ); + + return result; +} + +function twitterToUrl(twitter: string | null) { + if (!twitter) return twitter; + + return `https://twitter.com/${twitter}`; +} + +function discordInviteToUrl(discordInvite: string) { + return `https://discord.com/invite/${discordInvite}`; }