diff --git a/react-ui/src/components/user/UserPage.js b/react-ui/src/components/user/UserPage.js index ac1cf8b3e..8e51d0b89 100644 --- a/react-ui/src/components/user/UserPage.js +++ b/react-ui/src/components/user/UserPage.js @@ -73,7 +73,7 @@ const UserPage = () => { if ( userData.top500 || (userLeanQuery.data.user && userData.id === userLeanQuery.data.user.id) - ) + ) { panes.push({ menuItem: "X Rank", render: () => ( @@ -82,6 +82,7 @@ const UserPage = () => { ), }) + } const handleTabChange = (e, { activeIndex }) => { setActiveIndex(activeIndex) diff --git a/schemas/user.js b/schemas/user.js index 117fa52c6..9be19ea85 100644 --- a/schemas/user.js +++ b/schemas/user.js @@ -47,6 +47,11 @@ const resolvers = { top500: async root => { if (typeof root.top500 === "boolean") return root.top500 + if (!root.twitter_name) { + await User.findByIdAndUpdate(root._id, { top500: false }) + return false + } + const player = await Player.findOne({ twitter: root.twitter_name }).catch( e => { throw (new UserInputError(),