Restore old routes, enable user route as fallback.
2 unresolved threads
2 unresolved threads
Merge request reports
Activity
- make reserved routes admin expandable, so, for example i could add
/ngs
to it beause i have it as a route for ngnix to serve some static files even if BE is down. - make BE expose the said routes to FE so that FE can check for collisions too
- make FE check if route will go to a user profile page route instead of anything else, similar to what test does.
- [optional] contemplate on stupidity of the whole situation and think about adding more reserved names and breaking some links.
- make reserved routes admin expandable, so, for example i could add
added 1 commit
- f35dbaf0 - Treat reserved users like external users in the frontend.
@hj implemented that
mentioned in issue #246 (closed)
1 const generateProfileLink = (id, screenName) => { 1 import { includes } from 'lodash' 2 3 const generateProfileLink = (id, screenName, restrictedNicknames) => { 4 const complicated = (isExternal(screenName) || includes(restrictedNicknames, screenName)) 1 const generateProfileLink = (id, screenName) => { 1 import { includes } from 'lodash' 2 3 const generateProfileLink = (id, screenName, restrictedNicknames) => { 4 const complicated = (isExternal(screenName) || includes(restrictedNicknames, screenName)) 2 5 return { 3 name: (isExternal(screenName) ? 'external-user-profile' : 'user-profile'), 4 params: (isExternal(screenName) ? { id } : { name: screenName }) 6 name: (complicated ? 'external-user-profile' : 'user-profile'), It's more complicated than you think! The more I look into this code the more i feel like unit tests are neccesary.
-
'external-user-profile'
and'user-profile'
are essentially same route URL-wise, with few gotchas that make me wonder how vue will react. -
'external-user-profile'
usesid
param and will probably break if you give itname
param -
'user-profile'
usesname
param and has both optional part and extreme collisions - will{ name: 'settings' }
generate/settings
or/user/settings
?
something must be done at least. Maybe change
name
toid
for both routes to avoid superfluous branching?-
some nitpickings, but otherwise looks good. I'd probably check how vue generates routes for colliding routes (see !440 (comment 11639)) and also maybe keep FE-specific list of reserved nicknames for BE (devs) to be aware of, but that's stuff for the future.
mentioned in commit 1555a5fe
Please register or sign in to reply