bug fix with top500 on users without twitter

This commit is contained in:
Sendou
2019-12-15 19:59:08 +02:00
parent 01f6559e28
commit 6c952dfd59
2 changed files with 7 additions and 1 deletions

View File

@@ -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 = () => {
</Tab.Pane>
),
})
}
const handleTabChange = (e, { activeIndex }) => {
setActiveIndex(activeIndex)

View File

@@ -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(),