mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 18:22:40 +00:00
cleanup
This commit is contained in:
@@ -57,7 +57,7 @@ const AccountPage = createClass({
|
|||||||
<p><strong>Linked to Google: </strong> {this.props.uiItems.googleId ? 'YES' : 'NO'}</p>
|
<p><strong>Linked to Google: </strong> {this.props.uiItems.googleId ? 'YES' : 'NO'}</p>
|
||||||
{this.props.uiItems.googleId &&
|
{this.props.uiItems.googleId &&
|
||||||
<p>
|
<p>
|
||||||
<strong>Brews on Google Drive: </strong> {this.props.uiItems.googleCount ? this.props.uiItems.googleCount : <>Unable to retrieve files - <a href='https://github.com/naturalcrit/homebrewery/discussions/1580'>follow these steps to renew your Google credentials.</a></>}
|
<strong>Brews on Google Drive: </strong> {this.props.uiItems.googleCount ?? <>Unable to retrieve files - <a href='https://github.com/naturalcrit/homebrewery/discussions/1580'>follow these steps to renew your Google credentials.</a></>}
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -361,30 +361,20 @@ app.get('/account', asyncHandler(async (req, res, next)=>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const aggregateQuery =[{
|
const query = { authors: req.account.username, googleId: { $exists: false } };
|
||||||
'$match' : {
|
const mongoCount = await HomebrewModel.countDocuments(query)
|
||||||
'googleId' : {
|
|
||||||
'$exists' : false
|
|
||||||
},
|
|
||||||
'authors' : req.account.username
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
'$count' : 'total'
|
|
||||||
}];
|
|
||||||
const mongoCount = [];
|
|
||||||
mongoCount.push(...await HomebrewModel.aggregate(aggregateQuery)
|
|
||||||
.catch((err)=>{
|
.catch((err)=>{
|
||||||
|
mongoCount = 0;
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}));
|
});
|
||||||
mongoCount.push({ total: 0 });
|
|
||||||
|
|
||||||
data.uiItems = {
|
data.uiItems = {
|
||||||
username : req.account.username,
|
username : req.account.username,
|
||||||
issued : req.account.issued,
|
issued : req.account.issued,
|
||||||
mongoCount : mongoCount[0]?.total.toString(),
|
|
||||||
googleId : Boolean(req.account.googleId),
|
googleId : Boolean(req.account.googleId),
|
||||||
authCheck : Boolean(req.account.googleId && auth.credentials.access_token),
|
authCheck : Boolean(req.account.googleId && auth.credentials.access_token),
|
||||||
googleCount : googleCount?.length.toString() || null
|
mongoCount : mongoCount,
|
||||||
|
googleCount : googleCount?.length
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user