this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor get/set preferences

+261 -261
+2 -2
src/components/compose.jsx
··· 27 27 import Menu2 from '../components/menu2'; 28 28 import supportedLanguages from '../data/status-supported-languages'; 29 29 import urlRegex from '../data/url-regex'; 30 - import { api } from '../utils/api'; 30 + import { api, getPreferences } from '../utils/api'; 31 31 import { langDetector } from '../utils/browser-translator'; 32 32 import db from '../utils/db'; 33 33 import emojifyText from '../utils/emojify-text'; ··· 278 278 const [poll, setPoll] = useState(null); 279 279 const [scheduledAt, setScheduledAt] = useState(null); 280 280 281 - const prefs = store.account.get('preferences') || {}; 281 + const prefs = getPreferences(); 282 282 283 283 const oninputTextarea = () => { 284 284 if (!textareaRef.current) return;
+4 -5
src/components/media-post.jsx
··· 5 5 import { useContext, useMemo } from 'preact/hooks'; 6 6 import { useSnapshot } from 'valtio'; 7 7 8 + import { getPreferences } from '../utils/api'; 8 9 import FilterContext from '../utils/filter-context'; 9 10 import { isFiltered } from '../utils/filters'; 10 11 import states, { statusKey } from '../utils/states'; ··· 107 108 console.debug('RENDER Media post', id, status?.account.displayName); 108 109 109 110 const hasSpoiler = sensitive; 110 - const readingExpandMedia = useMemo(() => { 111 - // default | show_all | hide_all 112 - const prefs = store.account.get('preferences') || {}; 113 - return prefs['reading:expand:media']?.toLowerCase() || 'default'; 114 - }, []); 111 + const prefs = getPreferences(); 112 + const readingExpandMedia = 113 + prefs['reading:expand:media']?.toLowerCase() || 'default'; 115 114 const showSpoilerMedia = readingExpandMedia === 'show_all'; 116 115 117 116 const Parent = parent || 'div';
+13 -23
src/components/status.jsx
··· 40 40 import Modal from '../components/modal'; 41 41 import NameText from '../components/name-text'; 42 42 import Poll from '../components/poll'; 43 - import { api } from '../utils/api'; 43 + import { api, getPreferences } from '../utils/api'; 44 44 import { langDetector } from '../utils/browser-translator'; 45 45 import emojifyText from '../utils/emojify-text'; 46 46 import enhanceContent from '../utils/enhance-content'; ··· 344 344 }, 345 345 ); 346 346 347 - const getPrefs = mem( 348 - () => { 349 - return store.account.get('preferences') || {}; 350 - }, 351 - { 352 - maxAge: 60 * 1000, // 1 minute 353 - }, 354 - ); 355 - 356 347 function Status({ 357 348 statusID, 358 349 status, ··· 448 439 inReplyToAccountId, 449 440 content, 450 441 mentions, 451 - mediaAttachments, 442 + mediaAttachments = [], 452 443 reblog, 453 444 uri, 454 445 url, ··· 554 545 inReplyToAccountId === currentAccount || 555 546 mentions?.find((mention) => mention.id === currentAccount); 556 547 557 - const readingExpandSpoilers = useMemo(() => { 558 - const prefs = getPrefs(); 559 - return !!prefs['reading:expand:spoilers']; 560 - }, []); 561 - const readingExpandMedia = useMemo(() => { 562 - // default | show_all | hide_all 563 - // Ignore hide_all because it means hide *ALL* media including non-sensitive ones 564 - const prefs = getPrefs(); 565 - return prefs['reading:expand:media']?.toLowerCase() || 'default'; 566 - }, []); 548 + const prefs = getPreferences(); 549 + const readingExpandSpoilers = !!prefs['reading:expand:spoilers']; 550 + 551 + // default | show_all | hide_all 552 + // Ignore hide_all because it means hide *ALL* media including non-sensitive ones 553 + const readingExpandMedia = 554 + prefs['reading:expand:media']?.toLowerCase() || 'default'; 555 + 567 556 // FOR TESTING: 568 557 // const readingExpandSpoilers = true; 569 558 // const readingExpandMedia = 'show_all'; ··· 713 702 const textWeight = useCallback( 714 703 () => 715 704 Math.max( 716 - Math.round((spoilerText.length + htmlContentLength(content)) / 140) || 717 - 1, 705 + Math.round( 706 + ((spoilerText?.length || 0) + htmlContentLength(content)) / 140, 707 + ) || 1, 718 708 1, 719 709 ), 720 710 [spoilerText, content],
+220 -220
src/locales/en.po
··· 34 34 35 35 #: src/components/account-block.jsx:170 36 36 #: src/components/account-info.jsx:751 37 - #: src/components/status.jsx:588 37 + #: src/components/status.jsx:577 38 38 msgid "Group" 39 39 msgstr "" 40 40 ··· 111 111 #: src/components/compose.jsx:2776 112 112 #: src/components/media-alt-modal.jsx:46 113 113 #: src/components/media-modal.jsx:359 114 - #: src/components/status.jsx:1828 115 - #: src/components/status.jsx:1845 116 - #: src/components/status.jsx:1970 117 - #: src/components/status.jsx:2590 118 - #: src/components/status.jsx:2593 114 + #: src/components/status.jsx:1818 115 + #: src/components/status.jsx:1835 116 + #: src/components/status.jsx:1960 117 + #: src/components/status.jsx:2580 118 + #: src/components/status.jsx:2583 119 119 #: src/pages/account-statuses.jsx:526 120 120 #: src/pages/accounts.jsx:110 121 121 #: src/pages/hashtag.jsx:202 ··· 198 198 msgstr "" 199 199 200 200 #: src/components/account-info.jsx:978 201 - #: src/pages/catchup.jsx:71 201 + #: src/pages/catchup.jsx:70 202 202 msgid "Original" 203 203 msgstr "" 204 204 205 205 #: src/components/account-info.jsx:982 206 - #: src/components/status.jsx:2374 207 - #: src/pages/catchup.jsx:72 208 - #: src/pages/catchup.jsx:1449 209 - #: src/pages/catchup.jsx:2064 206 + #: src/components/status.jsx:2364 207 + #: src/pages/catchup.jsx:71 208 + #: src/pages/catchup.jsx:1448 209 + #: src/pages/catchup.jsx:2061 210 210 #: src/pages/status.jsx:962 211 211 #: src/pages/status.jsx:1585 212 212 msgid "Replies" 213 213 msgstr "" 214 214 215 215 #: src/components/account-info.jsx:986 216 - #: src/pages/catchup.jsx:73 217 - #: src/pages/catchup.jsx:1451 218 - #: src/pages/catchup.jsx:2076 216 + #: src/pages/catchup.jsx:72 217 + #: src/pages/catchup.jsx:1450 218 + #: src/pages/catchup.jsx:2073 219 219 #: src/pages/settings.jsx:1159 220 220 msgid "Boosts" 221 221 msgstr "" ··· 329 329 msgstr "" 330 330 331 331 #: src/components/account-info.jsx:1555 332 - #: src/components/status.jsx:1255 332 + #: src/components/status.jsx:1245 333 333 msgid "Link copied" 334 334 msgstr "" 335 335 336 336 #: src/components/account-info.jsx:1558 337 - #: src/components/status.jsx:1258 337 + #: src/components/status.jsx:1248 338 338 msgid "Unable to copy link" 339 339 msgstr "" 340 340 341 341 #: src/components/account-info.jsx:1564 342 342 #: src/components/shortcuts-settings.jsx:1059 343 - #: src/components/status.jsx:1264 344 - #: src/components/status.jsx:3368 343 + #: src/components/status.jsx:1254 344 + #: src/components/status.jsx:3358 345 345 msgid "Copy" 346 346 msgstr "" 347 347 348 348 #: src/components/account-info.jsx:1579 349 349 #: src/components/shortcuts-settings.jsx:1077 350 - #: src/components/status.jsx:1280 350 + #: src/components/status.jsx:1270 351 351 msgid "Sharing doesn't seem to work." 352 352 msgstr "" 353 353 354 354 #: src/components/account-info.jsx:1585 355 - #: src/components/status.jsx:1286 355 + #: src/components/status.jsx:1276 356 356 msgid "Share…" 357 357 msgstr "" 358 358 ··· 466 466 #: src/components/shortcuts-settings.jsx:230 467 467 #: src/components/shortcuts-settings.jsx:583 468 468 #: src/components/shortcuts-settings.jsx:783 469 - #: src/components/status.jsx:3092 470 - #: src/components/status.jsx:3332 471 - #: src/components/status.jsx:3841 469 + #: src/components/status.jsx:3082 470 + #: src/components/status.jsx:3322 471 + #: src/components/status.jsx:3831 472 472 #: src/pages/accounts.jsx:37 473 - #: src/pages/catchup.jsx:1585 473 + #: src/pages/catchup.jsx:1584 474 474 #: src/pages/filters.jsx:225 475 475 #: src/pages/list.jsx:280 476 476 #: src/pages/notifications.jsx:939 ··· 586 586 #: src/components/nav-menu.jsx:180 587 587 #: src/components/shortcuts-settings.jsx:139 588 588 #: src/components/timeline.jsx:465 589 - #: src/pages/catchup.jsx:884 589 + #: src/pages/catchup.jsx:883 590 590 #: src/pages/filters.jsx:90 591 591 #: src/pages/followed-hashtags.jsx:41 592 592 #: src/pages/home.jsx:54 ··· 709 709 msgstr "Attachment #{i} failed" 710 710 711 711 #: src/components/compose.jsx:1214 712 - #: src/components/status.jsx:2158 712 + #: src/components/status.jsx:2148 713 713 #: src/components/timeline.jsx:1019 714 714 msgid "Content warning" 715 715 msgstr "" ··· 745 745 746 746 #: src/components/compose.jsx:1281 747 747 #: src/components/status.jsx:100 748 - #: src/components/status.jsx:2034 748 + #: src/components/status.jsx:2024 749 749 msgid "Private mention" 750 750 msgstr "" 751 751 ··· 782 782 783 783 #: src/components/compose.jsx:1668 784 784 #: src/components/keyboard-shortcuts-help.jsx:155 785 - #: src/components/status.jsx:1027 786 - #: src/components/status.jsx:1808 787 - #: src/components/status.jsx:1809 788 - #: src/components/status.jsx:2494 785 + #: src/components/status.jsx:1017 786 + #: src/components/status.jsx:1798 787 + #: src/components/status.jsx:1799 788 + #: src/components/status.jsx:2484 789 789 msgid "Reply" 790 790 msgstr "" 791 791 ··· 853 853 #: src/components/compose.jsx:2696 854 854 #: src/components/compose.jsx:2946 855 855 #: src/components/shortcuts-settings.jsx:726 856 - #: src/pages/catchup.jsx:1082 856 + #: src/pages/catchup.jsx:1081 857 857 #: src/pages/filters.jsx:413 858 858 msgid "Remove" 859 859 msgstr "" ··· 1007 1007 1008 1008 #: src/components/drafts.jsx:128 1009 1009 #: src/components/list-add-edit.jsx:186 1010 - #: src/components/status.jsx:1430 1010 + #: src/components/status.jsx:1420 1011 1011 #: src/pages/filters.jsx:603 1012 1012 #: src/pages/scheduled-posts.jsx:369 1013 1013 msgid "Delete…" ··· 1034 1034 msgstr "" 1035 1035 1036 1036 #: src/components/drafts.jsx:247 1037 - #: src/pages/catchup.jsx:1935 1037 + #: src/pages/catchup.jsx:1932 1038 1038 msgid "Poll" 1039 1039 msgstr "" 1040 1040 ··· 1094 1094 1095 1095 #: src/components/keyboard-shortcuts-help.jsx:47 1096 1096 #: src/components/nav-menu.jsx:367 1097 - #: src/pages/catchup.jsx:1623 1097 + #: src/pages/catchup.jsx:1622 1098 1098 msgid "Keyboard shortcuts" 1099 1099 msgstr "" 1100 1100 ··· 1103 1103 msgstr "" 1104 1104 1105 1105 #: src/components/keyboard-shortcuts-help.jsx:59 1106 - #: src/pages/catchup.jsx:1648 1106 + #: src/pages/catchup.jsx:1647 1107 1107 msgid "Next post" 1108 1108 msgstr "" 1109 1109 1110 1110 #: src/components/keyboard-shortcuts-help.jsx:63 1111 - #: src/pages/catchup.jsx:1656 1111 + #: src/pages/catchup.jsx:1655 1112 1112 msgid "Previous post" 1113 1113 msgstr "" 1114 1114 ··· 1133 1133 msgstr "" 1134 1134 1135 1135 #: src/components/keyboard-shortcuts-help.jsx:87 1136 - #: src/pages/catchup.jsx:1680 1136 + #: src/pages/catchup.jsx:1679 1137 1137 msgid "Open post details" 1138 1138 msgstr "" 1139 1139 ··· 1216 1216 msgstr "" 1217 1217 1218 1218 #: src/components/keyboard-shortcuts-help.jsx:176 1219 - #: src/components/status.jsx:1035 1220 - #: src/components/status.jsx:2521 1221 - #: src/components/status.jsx:2544 1222 - #: src/components/status.jsx:2545 1219 + #: src/components/status.jsx:1025 1220 + #: src/components/status.jsx:2511 1221 + #: src/components/status.jsx:2534 1222 + #: src/components/status.jsx:2535 1223 1223 msgid "Boost" 1224 1224 msgstr "" 1225 1225 ··· 1228 1228 msgstr "" 1229 1229 1230 1230 #: src/components/keyboard-shortcuts-help.jsx:184 1231 - #: src/components/status.jsx:1098 1232 - #: src/components/status.jsx:2569 1233 - #: src/components/status.jsx:2570 1231 + #: src/components/status.jsx:1088 1232 + #: src/components/status.jsx:2559 1233 + #: src/components/status.jsx:2560 1234 1234 msgid "Bookmark" 1235 1235 msgstr "" 1236 1236 ··· 1289 1289 msgstr "" 1290 1290 1291 1291 #: src/components/media-alt-modal.jsx:58 1292 - #: src/components/status.jsx:1141 1293 - #: src/components/status.jsx:1150 1292 + #: src/components/status.jsx:1131 1293 + #: src/components/status.jsx:1140 1294 1294 #: src/components/translation-block.jsx:235 1295 1295 msgid "Translate" 1296 1296 msgstr "" 1297 1297 1298 1298 #: src/components/media-alt-modal.jsx:69 1299 - #: src/components/status.jsx:1169 1299 + #: src/components/status.jsx:1159 1300 1300 msgid "Speak" 1301 1301 msgstr "" 1302 1302 ··· 1324 1324 msgid "View post" 1325 1325 msgstr "" 1326 1326 1327 - #: src/components/media-post.jsx:128 1327 + #: src/components/media-post.jsx:127 1328 1328 msgid "Sensitive media" 1329 1329 msgstr "" 1330 1330 1331 - #: src/components/media-post.jsx:133 1331 + #: src/components/media-post.jsx:132 1332 1332 msgid "Filtered: {filterTitleStr}" 1333 1333 msgstr "" 1334 1334 1335 - #: src/components/media-post.jsx:134 1336 - #: src/components/status.jsx:3671 1337 - #: src/components/status.jsx:3767 1338 - #: src/components/status.jsx:3845 1335 + #: src/components/media-post.jsx:133 1336 + #: src/components/status.jsx:3661 1337 + #: src/components/status.jsx:3757 1338 + #: src/components/status.jsx:3835 1339 1339 #: src/components/timeline.jsx:1008 1340 - #: src/pages/catchup.jsx:76 1341 - #: src/pages/catchup.jsx:1883 1340 + #: src/pages/catchup.jsx:75 1341 + #: src/pages/catchup.jsx:1880 1342 1342 msgid "Filtered" 1343 1343 msgstr "" 1344 1344 ··· 1387 1387 msgstr "Following" 1388 1388 1389 1389 #: src/components/nav-menu.jsx:196 1390 - #: src/pages/catchup.jsx:879 1390 + #: src/pages/catchup.jsx:878 1391 1391 msgid "Catch-up" 1392 1392 msgstr "" 1393 1393 ··· 1432 1432 #: src/components/nav-menu.jsx:252 1433 1433 #: src/components/shortcuts-settings.jsx:55 1434 1434 #: src/components/shortcuts-settings.jsx:201 1435 - #: src/pages/catchup.jsx:1450 1436 - #: src/pages/catchup.jsx:2070 1435 + #: src/pages/catchup.jsx:1449 1436 + #: src/pages/catchup.jsx:2067 1437 1437 #: src/pages/favourites.jsx:12 1438 1438 #: src/pages/favourites.jsx:26 1439 1439 #: src/pages/settings.jsx:1155 ··· 1647 1647 msgstr "" 1648 1648 1649 1649 #: src/components/notification.jsx:441 1650 + #: src/components/status.jsx:1102 1650 1651 #: src/components/status.jsx:1112 1651 - #: src/components/status.jsx:1122 1652 1652 msgid "Boosted/Liked by…" 1653 1653 msgstr "" 1654 1654 ··· 1976 1976 msgstr "" 1977 1977 1978 1978 #: src/components/shortcuts-settings.jsx:379 1979 - #: src/components/status.jsx:1392 1979 + #: src/components/status.jsx:1382 1980 1980 #: src/pages/list.jsx:174 1981 1981 msgid "Edit" 1982 1982 msgstr "" ··· 2175 2175 msgid "Import/export settings from/to instance server (Very experimental)" 2176 2176 msgstr "" 2177 2177 2178 - #: src/components/status.jsx:612 2178 + #: src/components/status.jsx:601 2179 2179 msgid "<0/> <1>boosted</1>" 2180 2180 msgstr "" 2181 2181 2182 - #: src/components/status.jsx:711 2182 + #: src/components/status.jsx:700 2183 2183 msgid "Sorry, your current logged-in instance can't interact with this post from another instance." 2184 2184 msgstr "" 2185 2185 2186 2186 #. placeholder {0}: username || acct 2187 - #: src/components/status.jsx:864 2187 + #: src/components/status.jsx:854 2188 2188 msgid "Unliked @{0}'s post" 2189 2189 msgstr "" 2190 2190 2191 2191 #. placeholder {0}: username || acct 2192 - #: src/components/status.jsx:865 2192 + #: src/components/status.jsx:855 2193 2193 msgid "Liked @{0}'s post" 2194 2194 msgstr "Liked @{0}'s post" 2195 2195 2196 2196 #. placeholder {0}: username || acct 2197 - #: src/components/status.jsx:904 2197 + #: src/components/status.jsx:894 2198 2198 msgid "Unbookmarked @{0}'s post" 2199 2199 msgstr "Unbookmarked @{0}'s post" 2200 2200 2201 2201 #. placeholder {0}: username || acct 2202 - #: src/components/status.jsx:905 2202 + #: src/components/status.jsx:895 2203 2203 msgid "Bookmarked @{0}'s post" 2204 2204 msgstr "Bookmarked @{0}'s post" 2205 2205 2206 - #: src/components/status.jsx:1004 2206 + #: src/components/status.jsx:994 2207 2207 msgid "Some media have no descriptions." 2208 2208 msgstr "" 2209 2209 2210 2210 #. placeholder {0}: rtf.format(-statusMonthsAgo, 'month') 2211 - #: src/components/status.jsx:1011 2211 + #: src/components/status.jsx:1001 2212 2212 msgid "Old post (<0>{0}</0>)" 2213 2213 msgstr "" 2214 2214 2215 - #: src/components/status.jsx:1035 2216 - #: src/components/status.jsx:1075 2217 - #: src/components/status.jsx:2521 2218 - #: src/components/status.jsx:2544 2215 + #: src/components/status.jsx:1025 2216 + #: src/components/status.jsx:1065 2217 + #: src/components/status.jsx:2511 2218 + #: src/components/status.jsx:2534 2219 2219 msgid "Unboost" 2220 2220 msgstr "" 2221 2221 2222 - #: src/components/status.jsx:1051 2223 - #: src/components/status.jsx:2536 2222 + #: src/components/status.jsx:1041 2223 + #: src/components/status.jsx:2526 2224 2224 msgid "Quote" 2225 2225 msgstr "" 2226 2226 2227 2227 #. placeholder {0}: username || acct 2228 - #: src/components/status.jsx:1063 2229 - #: src/components/status.jsx:1526 2228 + #: src/components/status.jsx:1053 2229 + #: src/components/status.jsx:1516 2230 2230 msgid "Unboosted @{0}'s post" 2231 2231 msgstr "Unboosted @{0}'s post" 2232 2232 2233 2233 #. placeholder {0}: username || acct 2234 - #: src/components/status.jsx:1064 2235 - #: src/components/status.jsx:1527 2234 + #: src/components/status.jsx:1054 2235 + #: src/components/status.jsx:1517 2236 2236 msgid "Boosted @{0}'s post" 2237 2237 msgstr "Boosted @{0}'s post" 2238 2238 2239 - #: src/components/status.jsx:1076 2239 + #: src/components/status.jsx:1066 2240 2240 msgid "Boost…" 2241 2241 msgstr "" 2242 2242 2243 - #: src/components/status.jsx:1088 2244 - #: src/components/status.jsx:1818 2245 - #: src/components/status.jsx:2557 2243 + #: src/components/status.jsx:1078 2244 + #: src/components/status.jsx:1808 2245 + #: src/components/status.jsx:2547 2246 2246 msgid "Unlike" 2247 2247 msgstr "" 2248 2248 2249 - #: src/components/status.jsx:1089 2250 - #: src/components/status.jsx:1818 2251 - #: src/components/status.jsx:1819 2252 - #: src/components/status.jsx:2557 2253 - #: src/components/status.jsx:2558 2249 + #: src/components/status.jsx:1079 2250 + #: src/components/status.jsx:1808 2251 + #: src/components/status.jsx:1809 2252 + #: src/components/status.jsx:2547 2253 + #: src/components/status.jsx:2548 2254 2254 msgid "Like" 2255 2255 msgstr "" 2256 2256 2257 - #: src/components/status.jsx:1098 2258 - #: src/components/status.jsx:2569 2257 + #: src/components/status.jsx:1088 2258 + #: src/components/status.jsx:2559 2259 2259 msgid "Unbookmark" 2260 2260 msgstr "" 2261 2261 2262 - #: src/components/status.jsx:1181 2262 + #: src/components/status.jsx:1171 2263 2263 msgid "Post text copied" 2264 2264 msgstr "Post text copied" 2265 2265 2266 - #: src/components/status.jsx:1184 2266 + #: src/components/status.jsx:1174 2267 2267 msgid "Unable to copy post text" 2268 2268 msgstr "Unable to copy post text" 2269 2269 2270 - #: src/components/status.jsx:1190 2270 + #: src/components/status.jsx:1180 2271 2271 msgid "Copy post text" 2272 2272 msgstr "Copy post text" 2273 2273 2274 2274 #. placeholder {0}: username || acct 2275 - #: src/components/status.jsx:1208 2275 + #: src/components/status.jsx:1198 2276 2276 msgid "View post by <0>@{0}</0>" 2277 2277 msgstr "" 2278 2278 2279 - #: src/components/status.jsx:1229 2279 + #: src/components/status.jsx:1219 2280 2280 msgid "Show Edit History" 2281 2281 msgstr "" 2282 2282 2283 - #: src/components/status.jsx:1232 2283 + #: src/components/status.jsx:1222 2284 2284 msgid "Edited: {editedDateText}" 2285 2285 msgstr "" 2286 2286 2287 - #: src/components/status.jsx:1299 2288 - #: src/components/status.jsx:3337 2287 + #: src/components/status.jsx:1289 2288 + #: src/components/status.jsx:3327 2289 2289 msgid "Embed post" 2290 2290 msgstr "" 2291 2291 2292 - #: src/components/status.jsx:1313 2292 + #: src/components/status.jsx:1303 2293 2293 msgid "Conversation unmuted" 2294 2294 msgstr "" 2295 2295 2296 - #: src/components/status.jsx:1313 2296 + #: src/components/status.jsx:1303 2297 2297 msgid "Conversation muted" 2298 2298 msgstr "" 2299 2299 2300 - #: src/components/status.jsx:1319 2300 + #: src/components/status.jsx:1309 2301 2301 msgid "Unable to unmute conversation" 2302 2302 msgstr "" 2303 2303 2304 - #: src/components/status.jsx:1320 2304 + #: src/components/status.jsx:1310 2305 2305 msgid "Unable to mute conversation" 2306 2306 msgstr "" 2307 2307 2308 - #: src/components/status.jsx:1329 2308 + #: src/components/status.jsx:1319 2309 2309 msgid "Unmute conversation" 2310 2310 msgstr "" 2311 2311 2312 - #: src/components/status.jsx:1336 2312 + #: src/components/status.jsx:1326 2313 2313 msgid "Mute conversation" 2314 2314 msgstr "" 2315 2315 2316 - #: src/components/status.jsx:1352 2316 + #: src/components/status.jsx:1342 2317 2317 msgid "Post unpinned from profile" 2318 2318 msgstr "" 2319 2319 2320 - #: src/components/status.jsx:1353 2320 + #: src/components/status.jsx:1343 2321 2321 msgid "Post pinned to profile" 2322 2322 msgstr "" 2323 2323 2324 - #: src/components/status.jsx:1358 2324 + #: src/components/status.jsx:1348 2325 2325 msgid "Unable to unpin post" 2326 2326 msgstr "" 2327 2327 2328 - #: src/components/status.jsx:1358 2328 + #: src/components/status.jsx:1348 2329 2329 msgid "Unable to pin post" 2330 2330 msgstr "" 2331 2331 2332 - #: src/components/status.jsx:1367 2332 + #: src/components/status.jsx:1357 2333 2333 msgid "Unpin from profile" 2334 2334 msgstr "" 2335 2335 2336 - #: src/components/status.jsx:1374 2336 + #: src/components/status.jsx:1364 2337 2337 msgid "Pin to profile" 2338 2338 msgstr "" 2339 2339 2340 - #: src/components/status.jsx:1403 2340 + #: src/components/status.jsx:1393 2341 2341 msgid "Delete this post?" 2342 2342 msgstr "" 2343 2343 2344 - #: src/components/status.jsx:1419 2344 + #: src/components/status.jsx:1409 2345 2345 msgid "Post deleted" 2346 2346 msgstr "" 2347 2347 2348 - #: src/components/status.jsx:1422 2348 + #: src/components/status.jsx:1412 2349 2349 msgid "Unable to delete post" 2350 2350 msgstr "" 2351 2351 2352 - #: src/components/status.jsx:1450 2352 + #: src/components/status.jsx:1440 2353 2353 msgid "Report post…" 2354 2354 msgstr "" 2355 2355 2356 - #: src/components/status.jsx:1819 2357 - #: src/components/status.jsx:1855 2358 - #: src/components/status.jsx:2558 2356 + #: src/components/status.jsx:1809 2357 + #: src/components/status.jsx:1845 2358 + #: src/components/status.jsx:2548 2359 2359 msgid "Liked" 2360 2360 msgstr "" 2361 2361 2362 - #: src/components/status.jsx:1852 2363 - #: src/components/status.jsx:2545 2362 + #: src/components/status.jsx:1842 2363 + #: src/components/status.jsx:2535 2364 2364 msgid "Boosted" 2365 2365 msgstr "" 2366 2366 2367 - #: src/components/status.jsx:1862 2368 - #: src/components/status.jsx:2570 2367 + #: src/components/status.jsx:1852 2368 + #: src/components/status.jsx:2560 2369 2369 msgid "Bookmarked" 2370 2370 msgstr "" 2371 2371 2372 - #: src/components/status.jsx:1866 2372 + #: src/components/status.jsx:1856 2373 2373 msgid "Pinned" 2374 2374 msgstr "" 2375 2375 2376 - #: src/components/status.jsx:1912 2377 - #: src/components/status.jsx:2382 2376 + #: src/components/status.jsx:1902 2377 + #: src/components/status.jsx:2372 2378 2378 msgid "Deleted" 2379 2379 msgstr "" 2380 2380 2381 - #: src/components/status.jsx:1953 2381 + #: src/components/status.jsx:1943 2382 2382 msgid "{repliesCount, plural, one {# reply} other {# replies}}" 2383 2383 msgstr "" 2384 2384 2385 2385 #. placeholder {0}: snapStates.statusThreadNumber[sKey] ? ` ${snapStates.statusThreadNumber[sKey]}/X` : '' 2386 - #: src/components/status.jsx:2043 2386 + #: src/components/status.jsx:2033 2387 2387 msgid "Thread{0}" 2388 2388 msgstr "" 2389 2389 2390 - #: src/components/status.jsx:2121 2391 - #: src/components/status.jsx:2183 2392 - #: src/components/status.jsx:2278 2390 + #: src/components/status.jsx:2111 2391 + #: src/components/status.jsx:2173 2392 + #: src/components/status.jsx:2268 2393 2393 msgid "Show less" 2394 2394 msgstr "" 2395 2395 2396 - #: src/components/status.jsx:2121 2397 - #: src/components/status.jsx:2183 2396 + #: src/components/status.jsx:2111 2397 + #: src/components/status.jsx:2173 2398 2398 msgid "Show content" 2399 2399 msgstr "" 2400 2400 2401 2401 #. placeholder {0}: filterInfo.titlesStr 2402 2402 #. placeholder {0}: filterInfo?.titlesStr 2403 - #: src/components/status.jsx:2274 2404 - #: src/pages/catchup.jsx:1882 2403 + #: src/components/status.jsx:2264 2404 + #: src/pages/catchup.jsx:1879 2405 2405 msgid "Filtered: {0}" 2406 2406 msgstr "Filtered: {0}" 2407 2407 2408 - #: src/components/status.jsx:2278 2408 + #: src/components/status.jsx:2268 2409 2409 msgid "Show media" 2410 2410 msgstr "" 2411 2411 2412 - #: src/components/status.jsx:2418 2412 + #: src/components/status.jsx:2408 2413 2413 msgid "Edited" 2414 2414 msgstr "" 2415 2415 2416 - #: src/components/status.jsx:2495 2416 + #: src/components/status.jsx:2485 2417 2417 msgid "Comments" 2418 2418 msgstr "" 2419 2419 2420 2420 #. More from [Author] 2421 - #: src/components/status.jsx:2795 2421 + #: src/components/status.jsx:2785 2422 2422 msgid "More from <0/>" 2423 2423 msgstr "More from <0/>" 2424 2424 2425 - #: src/components/status.jsx:3097 2425 + #: src/components/status.jsx:3087 2426 2426 msgid "Edit History" 2427 2427 msgstr "" 2428 2428 2429 - #: src/components/status.jsx:3101 2429 + #: src/components/status.jsx:3091 2430 2430 msgid "Failed to load history" 2431 2431 msgstr "" 2432 2432 2433 - #: src/components/status.jsx:3106 2433 + #: src/components/status.jsx:3096 2434 2434 #: src/pages/annual-report.jsx:45 2435 2435 msgid "Loading…" 2436 2436 msgstr "" 2437 2437 2438 - #: src/components/status.jsx:3342 2438 + #: src/components/status.jsx:3332 2439 2439 msgid "HTML Code" 2440 2440 msgstr "" 2441 2441 2442 - #: src/components/status.jsx:3359 2442 + #: src/components/status.jsx:3349 2443 2443 msgid "HTML code copied" 2444 2444 msgstr "" 2445 2445 2446 - #: src/components/status.jsx:3362 2446 + #: src/components/status.jsx:3352 2447 2447 msgid "Unable to copy HTML code" 2448 2448 msgstr "" 2449 2449 2450 - #: src/components/status.jsx:3374 2450 + #: src/components/status.jsx:3364 2451 2451 msgid "Media attachments:" 2452 2452 msgstr "" 2453 2453 2454 - #: src/components/status.jsx:3396 2454 + #: src/components/status.jsx:3386 2455 2455 msgid "Account Emojis:" 2456 2456 msgstr "" 2457 2457 2458 - #: src/components/status.jsx:3427 2459 - #: src/components/status.jsx:3472 2458 + #: src/components/status.jsx:3417 2459 + #: src/components/status.jsx:3462 2460 2460 msgid "static URL" 2461 2461 msgstr "" 2462 2462 2463 - #: src/components/status.jsx:3441 2463 + #: src/components/status.jsx:3431 2464 2464 msgid "Emojis:" 2465 2465 msgstr "" 2466 2466 2467 - #: src/components/status.jsx:3486 2467 + #: src/components/status.jsx:3476 2468 2468 msgid "Notes:" 2469 2469 msgstr "" 2470 2470 2471 - #: src/components/status.jsx:3490 2471 + #: src/components/status.jsx:3480 2472 2472 msgid "This is static, unstyled and scriptless. You may need to apply your own styles and edit as needed." 2473 2473 msgstr "" 2474 2474 2475 - #: src/components/status.jsx:3496 2475 + #: src/components/status.jsx:3486 2476 2476 msgid "Polls are not interactive, becomes a list with vote counts." 2477 2477 msgstr "" 2478 2478 2479 - #: src/components/status.jsx:3501 2479 + #: src/components/status.jsx:3491 2480 2480 msgid "Media attachments can be images, videos, audios or any file types." 2481 2481 msgstr "" 2482 2482 2483 - #: src/components/status.jsx:3507 2483 + #: src/components/status.jsx:3497 2484 2484 msgid "Post could be edited or deleted later." 2485 2485 msgstr "" 2486 2486 2487 - #: src/components/status.jsx:3513 2487 + #: src/components/status.jsx:3503 2488 2488 msgid "Preview" 2489 2489 msgstr "" 2490 2490 2491 - #: src/components/status.jsx:3522 2491 + #: src/components/status.jsx:3512 2492 2492 msgid "Note: This preview is lightly styled." 2493 2493 msgstr "" 2494 2494 2495 2495 #. [Name] [Visibility icon] boosted 2496 - #: src/components/status.jsx:3775 2496 + #: src/components/status.jsx:3765 2497 2497 msgid "<0/> <1/> boosted" 2498 2498 msgstr "" 2499 2499 ··· 2521 2521 2522 2522 #: src/components/timeline.jsx:981 2523 2523 #: src/components/timeline.jsx:988 2524 - #: src/pages/catchup.jsx:1900 2524 + #: src/pages/catchup.jsx:1897 2525 2525 msgid "Thread" 2526 2526 msgstr "" 2527 2527 ··· 2722 2722 msgid "Unable to load bookmarks." 2723 2723 msgstr "" 2724 2724 2725 - #: src/pages/catchup.jsx:55 2725 + #: src/pages/catchup.jsx:54 2726 2726 msgid "last 1 hour" 2727 2727 msgstr "" 2728 2728 2729 - #: src/pages/catchup.jsx:56 2729 + #: src/pages/catchup.jsx:55 2730 2730 msgid "last 2 hours" 2731 2731 msgstr "" 2732 2732 2733 - #: src/pages/catchup.jsx:57 2733 + #: src/pages/catchup.jsx:56 2734 2734 msgid "last 3 hours" 2735 2735 msgstr "" 2736 2736 2737 - #: src/pages/catchup.jsx:58 2737 + #: src/pages/catchup.jsx:57 2738 2738 msgid "last 4 hours" 2739 2739 msgstr "" 2740 2740 2741 - #: src/pages/catchup.jsx:59 2741 + #: src/pages/catchup.jsx:58 2742 2742 msgid "last 5 hours" 2743 2743 msgstr "" 2744 2744 2745 - #: src/pages/catchup.jsx:60 2745 + #: src/pages/catchup.jsx:59 2746 2746 msgid "last 6 hours" 2747 2747 msgstr "" 2748 2748 2749 - #: src/pages/catchup.jsx:61 2749 + #: src/pages/catchup.jsx:60 2750 2750 msgid "last 7 hours" 2751 2751 msgstr "" 2752 2752 2753 - #: src/pages/catchup.jsx:62 2753 + #: src/pages/catchup.jsx:61 2754 2754 msgid "last 8 hours" 2755 2755 msgstr "" 2756 2756 2757 - #: src/pages/catchup.jsx:63 2757 + #: src/pages/catchup.jsx:62 2758 2758 msgid "last 9 hours" 2759 2759 msgstr "" 2760 2760 2761 - #: src/pages/catchup.jsx:64 2761 + #: src/pages/catchup.jsx:63 2762 2762 msgid "last 10 hours" 2763 2763 msgstr "" 2764 2764 2765 - #: src/pages/catchup.jsx:65 2765 + #: src/pages/catchup.jsx:64 2766 2766 msgid "last 11 hours" 2767 2767 msgstr "" 2768 2768 2769 - #: src/pages/catchup.jsx:66 2769 + #: src/pages/catchup.jsx:65 2770 2770 msgid "last 12 hours" 2771 2771 msgstr "" 2772 2772 2773 - #: src/pages/catchup.jsx:67 2773 + #: src/pages/catchup.jsx:66 2774 2774 msgid "beyond 12 hours" 2775 2775 msgstr "" 2776 2776 2777 - #: src/pages/catchup.jsx:74 2777 + #: src/pages/catchup.jsx:73 2778 2778 msgid "Followed tags" 2779 2779 msgstr "" 2780 2780 2781 - #: src/pages/catchup.jsx:75 2781 + #: src/pages/catchup.jsx:74 2782 2782 msgid "Groups" 2783 2783 msgstr "" 2784 2784 2785 - #: src/pages/catchup.jsx:598 2785 + #: src/pages/catchup.jsx:597 2786 2786 msgid "Showing {selectedFilterCategory, select, all {all posts} original {original posts} replies {replies} boosts {boosts} followedTags {followed tags} groups {groups} filtered {filtered posts}}, {sortBy, select, createdAt {{sortOrder, select, asc {oldest} desc {latest}}} reblogsCount {{sortOrder, select, asc {fewest boosts} desc {most boosts}}} favouritesCount {{sortOrder, select, asc {fewest likes} desc {most likes}}} repliesCount {{sortOrder, select, asc {fewest replies} desc {most replies}}} density {{sortOrder, select, asc {least dense} desc {most dense}}}} first{groupBy, select, account {, grouped by authors} other {}}" 2787 2787 msgstr "Showing {selectedFilterCategory, select, all {all posts} original {original posts} replies {replies} boosts {boosts} followedTags {followed tags} groups {groups} filtered {filtered posts}}, {sortBy, select, createdAt {{sortOrder, select, asc {oldest} desc {latest}}} reblogsCount {{sortOrder, select, asc {fewest boosts} desc {most boosts}}} favouritesCount {{sortOrder, select, asc {fewest likes} desc {most likes}}} repliesCount {{sortOrder, select, asc {fewest replies} desc {most replies}}} density {{sortOrder, select, asc {least dense} desc {most dense}}}} first{groupBy, select, account {, grouped by authors} other {}}" 2788 2788 2789 - #: src/pages/catchup.jsx:890 2790 - #: src/pages/catchup.jsx:914 2789 + #: src/pages/catchup.jsx:889 2790 + #: src/pages/catchup.jsx:913 2791 2791 msgid "Catch-up <0>beta</0>" 2792 2792 msgstr "" 2793 2793 2794 - #: src/pages/catchup.jsx:904 2795 - #: src/pages/catchup.jsx:1589 2794 + #: src/pages/catchup.jsx:903 2795 + #: src/pages/catchup.jsx:1588 2796 2796 msgid "Help" 2797 2797 msgstr "" 2798 2798 2799 - #: src/pages/catchup.jsx:920 2799 + #: src/pages/catchup.jsx:919 2800 2800 msgid "What is this?" 2801 2801 msgstr "" 2802 2802 2803 - #: src/pages/catchup.jsx:923 2803 + #: src/pages/catchup.jsx:922 2804 2804 msgid "Catch-up is a separate timeline for your followings, offering a high-level view at a glance, with a simple, email-inspired interface to effortlessly sort and filter through posts." 2805 2805 msgstr "" 2806 2806 2807 - #: src/pages/catchup.jsx:934 2807 + #: src/pages/catchup.jsx:933 2808 2808 msgid "Preview of Catch-up UI" 2809 2809 msgstr "Preview of Catch-up UI" 2810 2810 2811 - #: src/pages/catchup.jsx:943 2811 + #: src/pages/catchup.jsx:942 2812 2812 msgid "Let's catch up" 2813 2813 msgstr "" 2814 2814 2815 - #: src/pages/catchup.jsx:948 2815 + #: src/pages/catchup.jsx:947 2816 2816 msgid "Let's catch up on the posts from your followings." 2817 2817 msgstr "" 2818 2818 2819 - #: src/pages/catchup.jsx:952 2819 + #: src/pages/catchup.jsx:951 2820 2820 msgid "Show me all posts from…" 2821 2821 msgstr "" 2822 2822 2823 - #: src/pages/catchup.jsx:975 2823 + #: src/pages/catchup.jsx:974 2824 2824 msgid "until the max" 2825 2825 msgstr "until the max" 2826 2826 2827 - #: src/pages/catchup.jsx:1005 2827 + #: src/pages/catchup.jsx:1004 2828 2828 msgid "Catch up" 2829 2829 msgstr "" 2830 2830 2831 - #: src/pages/catchup.jsx:1011 2831 + #: src/pages/catchup.jsx:1010 2832 2832 msgid "Overlaps with your last catch-up" 2833 2833 msgstr "" 2834 2834 2835 2835 #. placeholder {0}: dtf.format(new Date(lastCatchupEndAt)) 2836 - #: src/pages/catchup.jsx:1023 2836 + #: src/pages/catchup.jsx:1022 2837 2837 msgid "Until the last catch-up ({0})" 2838 2838 msgstr "" 2839 2839 2840 - #: src/pages/catchup.jsx:1032 2840 + #: src/pages/catchup.jsx:1031 2841 2841 msgid "Note: your instance might only show a maximum of 800 posts in the Home timeline regardless of the time range. Could be less or more." 2842 2842 msgstr "" 2843 2843 2844 - #: src/pages/catchup.jsx:1042 2844 + #: src/pages/catchup.jsx:1041 2845 2845 msgid "Previously…" 2846 2846 msgstr "" 2847 2847 2848 2848 #. placeholder {0}: pc.count 2849 - #: src/pages/catchup.jsx:1060 2849 + #: src/pages/catchup.jsx:1059 2850 2850 msgid "{0, plural, one {# post} other {# posts}}" 2851 2851 msgstr "" 2852 2852 2853 - #: src/pages/catchup.jsx:1070 2853 + #: src/pages/catchup.jsx:1069 2854 2854 msgid "Remove this catch-up?" 2855 2855 msgstr "Remove this catch-up?" 2856 2856 2857 2857 #. placeholder {0}: pc.id 2858 - #: src/pages/catchup.jsx:1073 2858 + #: src/pages/catchup.jsx:1072 2859 2859 msgid "Removing Catch-up {0}" 2860 2860 msgstr "Removing Catch-up {0}" 2861 2861 2862 2862 #. placeholder {0}: pc.id 2863 - #: src/pages/catchup.jsx:1077 2863 + #: src/pages/catchup.jsx:1076 2864 2864 msgid "Catch-up {0} removed" 2865 2865 msgstr "Catch-up {0} removed" 2866 2866 2867 - #: src/pages/catchup.jsx:1091 2867 + #: src/pages/catchup.jsx:1090 2868 2868 msgid "Note: Only max 3 will be stored. The rest will be automatically removed." 2869 2869 msgstr "" 2870 2870 2871 - #: src/pages/catchup.jsx:1106 2871 + #: src/pages/catchup.jsx:1105 2872 2872 msgid "Fetching posts…" 2873 2873 msgstr "" 2874 2874 2875 - #: src/pages/catchup.jsx:1109 2875 + #: src/pages/catchup.jsx:1108 2876 2876 msgid "This might take a while." 2877 2877 msgstr "" 2878 2878 2879 - #: src/pages/catchup.jsx:1144 2879 + #: src/pages/catchup.jsx:1143 2880 2880 msgid "Reset filters" 2881 2881 msgstr "" 2882 2882 2883 - #: src/pages/catchup.jsx:1152 2884 - #: src/pages/catchup.jsx:1595 2883 + #: src/pages/catchup.jsx:1151 2884 + #: src/pages/catchup.jsx:1594 2885 2885 msgid "Top links" 2886 2886 msgstr "" 2887 2887 2888 2888 #. placeholder {0}: sharers.map((s) => { const { avatarStatic, displayName } = s; return ( <button type="button" class="plain" style={{ padding: 0, }} onClick={(e) => { e.preventDefault(); e.stopPropagation(); // Reset and filter to author const { id } = s; setSelectedAuthor(id); setSelectedFilterCategory('all'); }} > <Avatar url={avatarStatic} size="s" alt={displayName} /> </button> ); }) 2889 - #: src/pages/catchup.jsx:1265 2889 + #: src/pages/catchup.jsx:1264 2890 2890 msgid "Shared by {0}" 2891 2891 msgstr "" 2892 2892 2893 - #: src/pages/catchup.jsx:1320 2893 + #: src/pages/catchup.jsx:1319 2894 2894 #: src/pages/mentions.jsx:154 2895 2895 #: src/pages/search.jsx:326 2896 2896 msgid "All" 2897 2897 msgstr "" 2898 2898 2899 2899 #. placeholder {0}: authorCountsList.length 2900 - #: src/pages/catchup.jsx:1405 2900 + #: src/pages/catchup.jsx:1404 2901 2901 msgid "{0, plural, one {# author} other {# authors}}" 2902 2902 msgstr "" 2903 2903 2904 - #: src/pages/catchup.jsx:1417 2904 + #: src/pages/catchup.jsx:1416 2905 2905 msgid "Sort" 2906 2906 msgstr "" 2907 2907 2908 - #: src/pages/catchup.jsx:1448 2908 + #: src/pages/catchup.jsx:1447 2909 2909 msgid "Date" 2910 2910 msgstr "Date" 2911 2911 2912 - #: src/pages/catchup.jsx:1452 2912 + #: src/pages/catchup.jsx:1451 2913 2913 msgid "Density" 2914 2914 msgstr "Density" 2915 2915 2916 2916 #. js-lingui-explicit-id 2917 - #: src/pages/catchup.jsx:1475 2917 + #: src/pages/catchup.jsx:1474 2918 2918 msgid "group.filter" 2919 2919 msgstr "Group" 2920 2920 2921 - #: src/pages/catchup.jsx:1490 2921 + #: src/pages/catchup.jsx:1489 2922 2922 msgid "Authors" 2923 2923 msgstr "Authors" 2924 2924 2925 - #: src/pages/catchup.jsx:1491 2925 + #: src/pages/catchup.jsx:1490 2926 2926 msgid "None" 2927 2927 msgstr "None" 2928 2928 2929 - #: src/pages/catchup.jsx:1507 2929 + #: src/pages/catchup.jsx:1506 2930 2930 msgid "Show all authors" 2931 2931 msgstr "" 2932 2932 2933 - #: src/pages/catchup.jsx:1558 2933 + #: src/pages/catchup.jsx:1557 2934 2934 msgid "You don't have to read everything." 2935 2935 msgstr "You don't have to read everything." 2936 2936 2937 - #: src/pages/catchup.jsx:1559 2937 + #: src/pages/catchup.jsx:1558 2938 2938 msgid "That's all." 2939 2939 msgstr "That's all." 2940 2940 2941 - #: src/pages/catchup.jsx:1567 2941 + #: src/pages/catchup.jsx:1566 2942 2942 msgid "Back to top" 2943 2943 msgstr "" 2944 2944 2945 - #: src/pages/catchup.jsx:1598 2945 + #: src/pages/catchup.jsx:1597 2946 2946 msgid "Links shared by followings, sorted by shared counts, boosts and likes." 2947 2947 msgstr "" 2948 2948 2949 - #: src/pages/catchup.jsx:1604 2949 + #: src/pages/catchup.jsx:1603 2950 2950 msgid "Sort: Density" 2951 2951 msgstr "" 2952 2952 2953 - #: src/pages/catchup.jsx:1607 2953 + #: src/pages/catchup.jsx:1606 2954 2954 msgid "Posts are sorted by information density or depth. Shorter posts are \"lighter\" while longer posts are \"heavier\". Posts with photos are \"heavier\" than posts without photos." 2955 2955 msgstr "" 2956 2956 2957 - #: src/pages/catchup.jsx:1614 2957 + #: src/pages/catchup.jsx:1613 2958 2958 msgid "Group: Authors" 2959 2959 msgstr "" 2960 2960 2961 - #: src/pages/catchup.jsx:1617 2961 + #: src/pages/catchup.jsx:1616 2962 2962 msgid "Posts are grouped by authors, sorted by posts count per author." 2963 2963 msgstr "" 2964 2964 2965 - #: src/pages/catchup.jsx:1664 2965 + #: src/pages/catchup.jsx:1663 2966 2966 msgid "Next author" 2967 2967 msgstr "" 2968 2968 2969 - #: src/pages/catchup.jsx:1672 2969 + #: src/pages/catchup.jsx:1671 2970 2970 msgid "Previous author" 2971 2971 msgstr "" 2972 2972 2973 - #: src/pages/catchup.jsx:1688 2973 + #: src/pages/catchup.jsx:1687 2974 2974 msgid "Scroll to top" 2975 2975 msgstr "" 2976 2976
+3 -6
src/pages/catchup.jsx
··· 15 15 useRef, 16 16 useState, 17 17 } from 'preact/hooks'; 18 - import punycode from 'punycode/'; 19 18 import { useHotkeys } from 'react-hotkeys-hook'; 20 19 import { useSearchParams } from 'react-router-dom'; 21 20 import { uid } from 'uid/single'; ··· 30 29 import NameText from '../components/name-text'; 31 30 import NavMenu from '../components/nav-menu'; 32 31 import RelativeTime from '../components/relative-time'; 33 - import { api } from '../utils/api'; 32 + import { api, getPreferences } from '../utils/api'; 34 33 import { oklab2rgb, rgb2oklab } from '../utils/color-utils'; 35 34 import db from '../utils/db'; 36 35 import emojifyText from '../utils/emojify-text'; ··· 1855 1854 const isThread = 1856 1855 (inReplyToId && inReplyToAccountId === account.id) || !!_thread; 1857 1856 1858 - const readingExpandSpoilers = useMemo(() => { 1859 - const prefs = store.account.get('preferences') || {}; 1860 - return !!prefs['reading:expand:spoilers']; 1861 - }, []); 1857 + const prefs = getPreferences(); 1858 + const readingExpandSpoilers = !!prefs['reading:expand:spoilers']; 1862 1859 // const readingExpandSpoilers = true; 1863 1860 const showMedia = 1864 1861 readingExpandSpoilers ||
+3 -3
src/pages/settings.jsx
··· 11 11 import Link from '../components/link'; 12 12 import RelativeTime from '../components/relative-time'; 13 13 import languages from '../data/translang-languages'; 14 - import { api } from '../utils/api'; 14 + import { api, getPreferences, setPreferences } from '../utils/api'; 15 15 import getTranslateTargetLanguage from '../utils/get-translate-target-language'; 16 16 import localeCode2Text from '../utils/localeCode2Text'; 17 17 import prettyBytes from '../utils/pretty-bytes'; ··· 55 55 const systemTargetLanguageText = localeCode2Text(systemTargetLanguage); 56 56 const currentTextSize = store.local.get('textSize') || DEFAULT_TEXT_SIZE; 57 57 58 - const [prefs, setPrefs] = useState(store.account.get('preferences') || {}); 58 + const [prefs, setPrefs] = useState(getPreferences()); 59 59 const { masto, authenticated, instance } = api(); 60 60 // Get preferences every time Settings is opened 61 61 // NOTE: Disabled for now because I don't expect this to change often. Also for some reason, the /api/v1/preferences endpoint is cached for a while and return old prefs if refresh immediately after changing them. ··· 300 300 ...prefs, 301 301 'posting:default:visibility': value, 302 302 }); 303 - store.account.set('preferences', { 303 + setPreferences({ 304 304 ...prefs, 305 305 'posting:default:visibility': value, 306 306 });
+16 -2
src/utils/api.js
··· 1 1 import { compareVersions, satisfies, validate } from 'compare-versions'; 2 2 import { createRestAPIClient, createStreamingAPIClient } from 'masto'; 3 3 4 + import mem from '../utils/mem'; 5 + 4 6 import store from './store'; 5 7 import { 6 8 getAccount, ··· 179 181 }); 180 182 } 181 183 184 + export const getPreferences = mem( 185 + () => store.account.get('preferences') || {}, 186 + { 187 + maxAge: 60 * 1000, // 1 minute 188 + }, 189 + ); 190 + 191 + export function setPreferences(preferences) { 192 + getPreferences.clear(); // clear memo cache 193 + store.account.set('preferences', preferences); 194 + } 195 + 182 196 export function hasPreferences() { 183 - return !!store.account.get('preferences'); 197 + return !!getPreferences(); 184 198 } 185 199 186 200 // Get preferences ··· 190 204 __BENCHMARK.start('fetch-preferences'); 191 205 const preferences = await masto.v1.preferences.fetch(); 192 206 __BENCHMARK.end('fetch-preferences'); 193 - store.account.set('preferences', preferences); 207 + setPreferences(preferences); 194 208 } catch (e) { 195 209 // silently fail 196 210 console.error(e);