Skip to content

Commit 05400b2

Browse files
committed
fix: mastodon link formatting
1 parent 89a315d commit 05400b2

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

components/ProfilePage/SocialMediaIcons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const SocialMediaIcons = ({
6464

6565
{mastodon && (
6666
<Col>
67-
<External plain href={`https://mastodon.org/${mastodon}`}>
67+
<External plain href={`https://mastodon.social/@${mastodon}`}>
6868
<Image alt={t("socials.mastodon")} src="/mastodon.svg" />
6969
</External>
7070
</Col>

components/db/profile/profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function useProfile() {
6767
instagram: false,
6868
fb: false,
6969
blueSky: false,
70-
mastodon: false,
70+
mastodon: false
7171
},
7272
updatingBillsFollowing: false,
7373
profile

components/db/profile/urlCleanup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ export function cleanSocialLinks(network: keyof SocialLinks, link: string) {
77
const index: number = path.indexOf(".com/") + 5
88
path = path.substring(index)
99
}
10+
if (
11+
network === "mastodon" &&
12+
path.substring(path.indexOf("@") + 1).charAt(0) === "@"
13+
) {
14+
path.replace(
15+
path.substring(path.indexOf("@") + 1),
16+
path.substring(path.indexOf("@") + 2)
17+
)
18+
}
1019
}
1120

1221
return path

0 commit comments

Comments
 (0)