Skip to content

Commit

Permalink
fix: mastodon link formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aaerhart committed Feb 5, 2025
1 parent 89a315d commit 05400b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/ProfilePage/SocialMediaIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const SocialMediaIcons = ({

{mastodon && (
<Col>
<External plain href={`https://mastodon.org/${mastodon}`}>
<External plain href={`https://mastodon.social/@${mastodon}`}>
<Image alt={t("socials.mastodon")} src="/mastodon.svg" />
</External>
</Col>
Expand Down
2 changes: 1 addition & 1 deletion components/db/profile/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function useProfile() {
instagram: false,
fb: false,
blueSky: false,
mastodon: false,
mastodon: false
},
updatingBillsFollowing: false,
profile
Expand Down
9 changes: 9 additions & 0 deletions components/db/profile/urlCleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ export function cleanSocialLinks(network: keyof SocialLinks, link: string) {
const index: number = path.indexOf(".com/") + 5
path = path.substring(index)
}
if (
network === "mastodon" &&
path.substring(path.indexOf("@") + 1).charAt(0) === "@"
) {
path.replace(
path.substring(path.indexOf("@") + 1),
path.substring(path.indexOf("@") + 2)
)
}
}

return path
Expand Down

0 comments on commit 05400b2

Please sign in to comment.