From 6ae31fca6ca6d7aaf1abcb42ddf31318ecddf292 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun <cheeaun@gmail.com>
Date: Fri, 14 Mar 2025 16:33:04 +0800
Subject: [PATCH] Linkify account string if it's a URL

---
 src/components/account-info.jsx |  10 +-
 src/locales/en.po               | 228 ++++++++++++++++----------------
 2 files changed, 123 insertions(+), 115 deletions(-)

diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx
index 3a291738..f4c44455 100644
--- a/src/components/account-info.jsx
+++ b/src/components/account-info.jsx
@@ -361,6 +361,8 @@ function AccountInfo({
     [id, instance],
   );
 
+  const isStringURL = isString && account && /^https?:\/\//.test(account);
+
   return (
     <div
       tabIndex="-1"
@@ -379,7 +381,13 @@ function AccountInfo({
           </p>
           {isString ? (
             <p>
-              <code class="insignificant">{account}</code>
+              {isStringURL ? (
+                <a href={account} target="_blank" rel="noopener">
+                  {account}
+                </a>
+              ) : (
+                <code class="insignificant">{account}</code>
+              )}
             </p>
           ) : (
             <p>
diff --git a/src/locales/en.po b/src/locales/en.po
index 71454ff8..e1083306 100644
--- a/src/locales/en.po
+++ b/src/locales/en.po
@@ -28,12 +28,12 @@ msgid "Last posted: {0}"
 msgstr ""
 
 #: src/components/account-block.jsx:162
-#: src/components/account-info.jsx:659
+#: src/components/account-info.jsx:667
 msgid "Automated"
 msgstr ""
 
 #: src/components/account-block.jsx:169
-#: src/components/account-info.jsx:664
+#: src/components/account-info.jsx:672
 #: src/components/status.jsx:547
 msgid "Group"
 msgstr ""
@@ -43,17 +43,17 @@ msgid "Mutual"
 msgstr ""
 
 #: src/components/account-block.jsx:183
-#: src/components/account-info.jsx:1705
+#: src/components/account-info.jsx:1713
 msgid "Requested"
 msgstr ""
 
 #: src/components/account-block.jsx:187
-#: src/components/account-info.jsx:1696
+#: src/components/account-info.jsx:1704
 msgid "Following"
 msgstr ""
 
 #: src/components/account-block.jsx:191
-#: src/components/account-info.jsx:1087
+#: src/components/account-info.jsx:1095
 msgid "Follows you"
 msgstr ""
 
@@ -62,14 +62,14 @@ msgid "{followersCount, plural, one {# follower} other {# followers}}"
 msgstr ""
 
 #: src/components/account-block.jsx:208
-#: src/components/account-info.jsx:705
+#: src/components/account-info.jsx:713
 msgid "Verified"
 msgstr ""
 
 #. placeholder {0}: niceDateTime(createdAt, { hideTime: true, })
 #. placeholder {0}: niceDateTime(createdAt, { hideTime: true, })
 #: src/components/account-block.jsx:223
-#: src/components/account-info.jsx:805
+#: src/components/account-info.jsx:813
 msgid "Joined <0>{0}</0>"
 msgstr ""
 
@@ -77,37 +77,37 @@ msgstr ""
 msgid "Forever"
 msgstr ""
 
-#: src/components/account-info.jsx:378
+#: src/components/account-info.jsx:380
 msgid "Unable to load account."
 msgstr ""
 
-#: src/components/account-info.jsx:387
+#: src/components/account-info.jsx:395
 msgid "Go to account page"
 msgstr ""
 
-#: src/components/account-info.jsx:416
-#: src/components/account-info.jsx:727
-#: src/components/account-info.jsx:757
+#: src/components/account-info.jsx:424
+#: src/components/account-info.jsx:735
+#: src/components/account-info.jsx:765
 msgid "Followers"
 msgstr ""
 
 #. js-lingui-explicit-id
-#: src/components/account-info.jsx:419
-#: src/components/account-info.jsx:767
-#: src/components/account-info.jsx:784
+#: src/components/account-info.jsx:427
+#: src/components/account-info.jsx:775
+#: src/components/account-info.jsx:792
 msgid "following.stats"
 msgstr "Following"
 
-#: src/components/account-info.jsx:422
-#: src/components/account-info.jsx:801
+#: src/components/account-info.jsx:430
+#: src/components/account-info.jsx:809
 #: src/pages/account-statuses.jsx:479
 #: src/pages/search.jsx:328
 #: src/pages/search.jsx:475
 msgid "Posts"
 msgstr ""
 
-#: src/components/account-info.jsx:430
-#: src/components/account-info.jsx:1143
+#: src/components/account-info.jsx:438
+#: src/components/account-info.jsx:1151
 #: src/components/compose.jsx:2772
 #: src/components/media-alt-modal.jsx:46
 #: src/components/media-modal.jsx:358
@@ -127,50 +127,50 @@ msgstr ""
 msgid "More"
 msgstr ""
 
-#: src/components/account-info.jsx:442
+#: src/components/account-info.jsx:450
 msgid "<0>{displayName}</0> has indicated that their new account is now:"
 msgstr ""
 
-#: src/components/account-info.jsx:587
-#: src/components/account-info.jsx:1301
+#: src/components/account-info.jsx:595
+#: src/components/account-info.jsx:1309
 msgid "Handle copied"
 msgstr "Handle copied"
 
-#: src/components/account-info.jsx:590
-#: src/components/account-info.jsx:1304
+#: src/components/account-info.jsx:598
+#: src/components/account-info.jsx:1312
 msgid "Unable to copy handle"
 msgstr "Unable to copy handle"
 
-#: src/components/account-info.jsx:596
-#: src/components/account-info.jsx:1310
+#: src/components/account-info.jsx:604
+#: src/components/account-info.jsx:1318
 msgid "Copy handle"
 msgstr ""
 
-#: src/components/account-info.jsx:602
+#: src/components/account-info.jsx:610
 msgid "Go to original profile page"
 msgstr ""
 
-#: src/components/account-info.jsx:620
+#: src/components/account-info.jsx:628
 msgid "View profile image"
 msgstr ""
 
-#: src/components/account-info.jsx:637
+#: src/components/account-info.jsx:645
 msgid "View profile header"
 msgstr ""
 
-#: src/components/account-info.jsx:654
+#: src/components/account-info.jsx:662
 msgid "In Memoriam"
 msgstr ""
 
-#: src/components/account-info.jsx:734
-#: src/components/account-info.jsx:775
+#: src/components/account-info.jsx:742
+#: src/components/account-info.jsx:783
 msgid "This user has chosen to not make this information available."
 msgstr "This user has chosen to not make this information available."
 
 #. placeholder {0}: ( postingStats.originals / postingStats.total ).toLocaleString(i18n.locale || undefined, { style: 'percent', })
 #. placeholder {1}: ( postingStats.replies / postingStats.total ).toLocaleString(i18n.locale || undefined, { style: 'percent', })
 #. placeholder {2}: ( postingStats.boosts / postingStats.total ).toLocaleString(i18n.locale || undefined, { style: 'percent', })
-#: src/components/account-info.jsx:830
+#: src/components/account-info.jsx:838
 msgid "{0} original posts, {1} replies, {2} boosts"
 msgstr "{0} original posts, {1} replies, {2} boosts"
 
@@ -181,22 +181,22 @@ msgstr "{0} original posts, {1} replies, {2} boosts"
 #. placeholder {4}: postingStats.total
 #. placeholder {5}: postingStats.total
 #. placeholder {6}: postingStats.daysSinceLastPost
-#: src/components/account-info.jsx:846
+#: src/components/account-info.jsx:854
 msgid "{0, plural, one {{1, plural, one {Last 1 post in the past 1 day} other {Last 1 post in the past {2} days}}} other {{3, plural, one {Last {4} posts in the past 1 day} other {Last {5} posts in the past {6} days}}}}"
 msgstr ""
 
 #. placeholder {0}: postingStats.total
 #. placeholder {1}: postingStats.total
-#: src/components/account-info.jsx:859
+#: src/components/account-info.jsx:867
 msgid "{0, plural, one {Last 1 post in the past year(s)} other {Last {1} posts in the past year(s)}}"
 msgstr ""
 
-#: src/components/account-info.jsx:883
+#: src/components/account-info.jsx:891
 #: src/pages/catchup.jsx:70
 msgid "Original"
 msgstr ""
 
-#: src/components/account-info.jsx:887
+#: src/components/account-info.jsx:895
 #: src/components/status.jsx:2303
 #: src/pages/catchup.jsx:71
 #: src/pages/catchup.jsx:1445
@@ -206,7 +206,7 @@ msgstr ""
 msgid "Replies"
 msgstr ""
 
-#: src/components/account-info.jsx:891
+#: src/components/account-info.jsx:899
 #: src/pages/catchup.jsx:72
 #: src/pages/catchup.jsx:1447
 #: src/pages/catchup.jsx:2070
@@ -214,210 +214,210 @@ msgstr ""
 msgid "Boosts"
 msgstr ""
 
-#: src/components/account-info.jsx:897
+#: src/components/account-info.jsx:905
 msgid "Post stats unavailable."
 msgstr ""
 
-#: src/components/account-info.jsx:928
+#: src/components/account-info.jsx:936
 msgid "View post stats"
 msgstr ""
 
 #. placeholder {0}: niceDateTime(lastStatusAt, { hideTime: true, })
-#: src/components/account-info.jsx:1091
+#: src/components/account-info.jsx:1099
 msgid "Last post: <0>{0}</0>"
 msgstr ""
 
-#: src/components/account-info.jsx:1105
+#: src/components/account-info.jsx:1113
 msgid "Muted"
 msgstr ""
 
-#: src/components/account-info.jsx:1110
+#: src/components/account-info.jsx:1118
 msgid "Blocked"
 msgstr ""
 
-#: src/components/account-info.jsx:1119
+#: src/components/account-info.jsx:1127
 msgid "Private note"
 msgstr "Private note"
 
-#: src/components/account-info.jsx:1176
+#: src/components/account-info.jsx:1184
 msgid "Mention <0>@{username}</0>"
 msgstr ""
 
-#: src/components/account-info.jsx:1188
+#: src/components/account-info.jsx:1196
 msgid "Translate bio"
 msgstr ""
 
-#: src/components/account-info.jsx:1199
+#: src/components/account-info.jsx:1207
 msgid "Edit private note"
 msgstr "Edit private note"
 
-#: src/components/account-info.jsx:1199
+#: src/components/account-info.jsx:1207
 msgid "Add private note"
 msgstr "Add private note"
 
-#: src/components/account-info.jsx:1219
+#: src/components/account-info.jsx:1227
 msgid "Notifications enabled for @{username}'s posts."
 msgstr "Notifications enabled for @{username}'s posts."
 
-#: src/components/account-info.jsx:1220
+#: src/components/account-info.jsx:1228
 msgid " Notifications disabled for @{username}'s posts."
 msgstr " Notifications disabled for @{username}'s posts."
 
-#: src/components/account-info.jsx:1232
+#: src/components/account-info.jsx:1240
 msgid "Disable notifications"
 msgstr "Disable notifications"
 
-#: src/components/account-info.jsx:1233
+#: src/components/account-info.jsx:1241
 msgid "Enable notifications"
 msgstr "Enable notifications"
 
-#: src/components/account-info.jsx:1250
+#: src/components/account-info.jsx:1258
 msgid "Boosts from @{username} enabled."
 msgstr "Boosts from @{username} enabled."
 
-#: src/components/account-info.jsx:1251
+#: src/components/account-info.jsx:1259
 msgid "Boosts from @{username} disabled."
 msgstr "Boosts from @{username} disabled."
 
-#: src/components/account-info.jsx:1262
+#: src/components/account-info.jsx:1270
 msgid "Disable boosts"
 msgstr "Disable boosts"
 
-#: src/components/account-info.jsx:1262
+#: src/components/account-info.jsx:1270
 msgid "Enable boosts"
 msgstr "Enable boosts"
 
-#: src/components/account-info.jsx:1278
-#: src/components/account-info.jsx:1288
-#: src/components/account-info.jsx:1891
+#: src/components/account-info.jsx:1286
+#: src/components/account-info.jsx:1296
+#: src/components/account-info.jsx:1899
 msgid "Add/Remove from Lists"
 msgstr ""
 
-#: src/components/account-info.jsx:1327
+#: src/components/account-info.jsx:1335
 #: src/components/status.jsx:1210
 msgid "Link copied"
 msgstr ""
 
-#: src/components/account-info.jsx:1330
+#: src/components/account-info.jsx:1338
 #: src/components/status.jsx:1213
 msgid "Unable to copy link"
 msgstr ""
 
-#: src/components/account-info.jsx:1336
+#: src/components/account-info.jsx:1344
 #: src/components/shortcuts-settings.jsx:1059
 #: src/components/status.jsx:1219
 #: src/components/status.jsx:3298
 msgid "Copy"
 msgstr ""
 
-#: src/components/account-info.jsx:1351
+#: src/components/account-info.jsx:1359
 #: src/components/shortcuts-settings.jsx:1077
 #: src/components/status.jsx:1235
 msgid "Sharing doesn't seem to work."
 msgstr ""
 
-#: src/components/account-info.jsx:1357
+#: src/components/account-info.jsx:1365
 #: src/components/status.jsx:1241
 msgid "Share…"
 msgstr ""
 
-#: src/components/account-info.jsx:1377
+#: src/components/account-info.jsx:1385
 msgid "Unmuted @{username}"
 msgstr "Unmuted @{username}"
 
-#: src/components/account-info.jsx:1389
+#: src/components/account-info.jsx:1397
 msgid "Unmute <0>@{username}</0>"
 msgstr ""
 
-#: src/components/account-info.jsx:1405
+#: src/components/account-info.jsx:1413
 msgid "Mute <0>@{username}</0>…"
 msgstr ""
 
 #. placeholder {0}: typeof MUTE_DURATIONS_LABELS[duration] === 'function' ? MUTE_DURATIONS_LABELS[duration]() : _(MUTE_DURATIONS_LABELS[duration])
-#: src/components/account-info.jsx:1437
+#: src/components/account-info.jsx:1445
 msgid "Muted @{username} for {0}"
 msgstr "Muted @{username} for {0}"
 
-#: src/components/account-info.jsx:1449
+#: src/components/account-info.jsx:1457
 msgid "Unable to mute @{username}"
 msgstr "Unable to mute @{username}"
 
-#: src/components/account-info.jsx:1470
+#: src/components/account-info.jsx:1478
 msgid "Remove <0>@{username}</0> from followers?"
 msgstr ""
 
-#: src/components/account-info.jsx:1490
+#: src/components/account-info.jsx:1498
 msgid "@{username} removed from followers"
 msgstr "@{username} removed from followers"
 
-#: src/components/account-info.jsx:1502
+#: src/components/account-info.jsx:1510
 msgid "Remove follower…"
 msgstr ""
 
-#: src/components/account-info.jsx:1513
+#: src/components/account-info.jsx:1521
 msgid "Block <0>@{username}</0>?"
 msgstr ""
 
-#: src/components/account-info.jsx:1537
+#: src/components/account-info.jsx:1545
 msgid "Unblocked @{username}"
 msgstr "Unblocked @{username}"
 
-#: src/components/account-info.jsx:1545
+#: src/components/account-info.jsx:1553
 msgid "Blocked @{username}"
 msgstr "Blocked @{username}"
 
-#: src/components/account-info.jsx:1553
+#: src/components/account-info.jsx:1561
 msgid "Unable to unblock @{username}"
 msgstr "Unable to unblock @{username}"
 
-#: src/components/account-info.jsx:1555
+#: src/components/account-info.jsx:1563
 msgid "Unable to block @{username}"
 msgstr "Unable to block @{username}"
 
-#: src/components/account-info.jsx:1565
+#: src/components/account-info.jsx:1573
 msgid "Unblock <0>@{username}</0>"
 msgstr ""
 
-#: src/components/account-info.jsx:1574
+#: src/components/account-info.jsx:1582
 msgid "Block <0>@{username}</0>…"
 msgstr ""
 
-#: src/components/account-info.jsx:1591
+#: src/components/account-info.jsx:1599
 msgid "Report <0>@{username}</0>…"
 msgstr ""
 
-#: src/components/account-info.jsx:1611
-#: src/components/account-info.jsx:2145
+#: src/components/account-info.jsx:1619
+#: src/components/account-info.jsx:2153
 msgid "Edit profile"
 msgstr ""
 
-#: src/components/account-info.jsx:1647
+#: src/components/account-info.jsx:1655
 msgid "Withdraw follow request?"
 msgstr "Withdraw follow request?"
 
 #. placeholder {1}: info.acct || info.username
-#: src/components/account-info.jsx:1648
+#: src/components/account-info.jsx:1656
 msgid "Unfollow @{1}?"
 msgstr "Unfollow @{1}?"
 
-#: src/components/account-info.jsx:1699
+#: src/components/account-info.jsx:1707
 msgid "Unfollow…"
 msgstr ""
 
-#: src/components/account-info.jsx:1708
+#: src/components/account-info.jsx:1716
 msgid "Withdraw…"
 msgstr ""
 
-#: src/components/account-info.jsx:1715
-#: src/components/account-info.jsx:1719
+#: src/components/account-info.jsx:1723
+#: src/components/account-info.jsx:1727
 #: src/pages/hashtag.jsx:262
 msgid "Follow"
 msgstr ""
 
-#: src/components/account-info.jsx:1831
-#: src/components/account-info.jsx:1886
-#: src/components/account-info.jsx:2020
-#: src/components/account-info.jsx:2140
+#: src/components/account-info.jsx:1839
+#: src/components/account-info.jsx:1894
+#: src/components/account-info.jsx:2028
+#: src/components/account-info.jsx:2148
 #: src/components/account-sheet.jsx:38
 #: src/components/compose.jsx:881
 #: src/components/compose.jsx:2728
@@ -450,85 +450,85 @@ msgstr ""
 msgid "Close"
 msgstr ""
 
-#: src/components/account-info.jsx:1836
+#: src/components/account-info.jsx:1844
 msgid "Translated Bio"
 msgstr ""
 
-#: src/components/account-info.jsx:1931
+#: src/components/account-info.jsx:1939
 msgid "Unable to remove from list."
 msgstr "Unable to remove from list."
 
-#: src/components/account-info.jsx:1932
+#: src/components/account-info.jsx:1940
 msgid "Unable to add to list."
 msgstr "Unable to add to list."
 
-#: src/components/account-info.jsx:1951
+#: src/components/account-info.jsx:1959
 #: src/pages/lists.jsx:105
 msgid "Unable to load lists."
 msgstr ""
 
-#: src/components/account-info.jsx:1955
+#: src/components/account-info.jsx:1963
 msgid "No lists."
 msgstr ""
 
-#: src/components/account-info.jsx:1966
+#: src/components/account-info.jsx:1974
 #: src/components/list-add-edit.jsx:40
 #: src/pages/lists.jsx:59
 msgid "New list"
 msgstr ""
 
 #. placeholder {0}: account?.username || account?.acct
-#: src/components/account-info.jsx:2025
+#: src/components/account-info.jsx:2033
 msgid "Private note about <0>@{0}</0>"
 msgstr ""
 
-#: src/components/account-info.jsx:2055
+#: src/components/account-info.jsx:2063
 msgid "Unable to update private note."
 msgstr "Unable to update private note."
 
-#: src/components/account-info.jsx:2078
-#: src/components/account-info.jsx:2376
+#: src/components/account-info.jsx:2086
+#: src/components/account-info.jsx:2384
 msgid "Cancel"
 msgstr ""
 
-#: src/components/account-info.jsx:2083
+#: src/components/account-info.jsx:2091
 msgid "Save & close"
 msgstr ""
 
-#: src/components/account-info.jsx:2200
+#: src/components/account-info.jsx:2208
 msgid "Unable to update profile."
 msgstr "Unable to update profile."
 
-#: src/components/account-info.jsx:2207
+#: src/components/account-info.jsx:2215
 msgid "Header picture"
 msgstr "Header picture"
 
-#: src/components/account-info.jsx:2259
+#: src/components/account-info.jsx:2267
 msgid "Profile picture"
 msgstr "Profile picture"
 
-#: src/components/account-info.jsx:2311
+#: src/components/account-info.jsx:2319
 #: src/components/list-add-edit.jsx:105
 msgid "Name"
 msgstr ""
 
-#: src/components/account-info.jsx:2324
+#: src/components/account-info.jsx:2332
 msgid "Bio"
 msgstr ""
 
-#: src/components/account-info.jsx:2337
+#: src/components/account-info.jsx:2345
 msgid "Extra fields"
 msgstr ""
 
-#: src/components/account-info.jsx:2343
+#: src/components/account-info.jsx:2351
 msgid "Label"
 msgstr ""
 
-#: src/components/account-info.jsx:2346
+#: src/components/account-info.jsx:2354
 msgid "Content"
 msgstr ""
 
-#: src/components/account-info.jsx:2379
+#: src/components/account-info.jsx:2387
 #: src/components/list-add-edit.jsx:150
 #: src/components/shortcuts-settings.jsx:715
 #: src/pages/filters.jsx:554
@@ -536,11 +536,11 @@ msgstr ""
 msgid "Save"
 msgstr ""
 
-#: src/components/account-info.jsx:2433
+#: src/components/account-info.jsx:2441
 msgid "username"
 msgstr ""
 
-#: src/components/account-info.jsx:2437
+#: src/components/account-info.jsx:2445
 msgid "server domain name"
 msgstr ""