diff options
| author | Henry Jameson <me@hjkos.com> | 2023-03-20 22:48:38 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-03-20 22:48:38 +0200 |
| commit | 819cd41cf0c4b2140470bba2a36eb15ed811c5b7 (patch) | |
| tree | 0608e5f10fa4028391e1100729e5fade4d3ba08c /src/components/navigation/navigation.js | |
| parent | 332ad77e3579d2b512ba236b3f2c94ad8875864d (diff) | |
| parent | fa532b1f005220743d036b7d103c47a043be7ae4 (diff) | |
Merge remote-tracking branch 'origin/develop' into improve_settings_reusability
* origin/develop:
Translated using Weblate (Chinese (Simplified))
Generalize IntegerSetting into NumberSetting, add Integer/Float wrappers
Allow custom emoji reactions: add option to scale reaction buttons
Fix user-profile route crash on pinned favorites route
Hide custom emoji in reaction picker when BE does not advertise pleroma_custom_emoji_reactions
Allow custom emoji reactions
Diffstat (limited to 'src/components/navigation/navigation.js')
| -rw-r--r-- | src/components/navigation/navigation.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/components/navigation/navigation.js b/src/components/navigation/navigation.js index 7f096316..face430e 100644 --- a/src/components/navigation/navigation.js +++ b/src/components/navigation/navigation.js @@ -80,3 +80,21 @@ export const ROOT_ITEMS = { criteria: ['announcements'] } } + +export function routeTo (item, currentUser) { + if (!item.route && !item.routeObject) return null + + let route + + if (item.routeObject) { + route = item.routeObject + } else { + route = { name: (item.anon || currentUser) ? item.route : item.anonRoute } + } + + if (USERNAME_ROUTES.has(route.name)) { + route.params = { username: currentUser.screen_name, name: currentUser.screen_name } + } + + return route +} |
