fixed incorrect tag id bug, tag not saving to snap bug

This commit is contained in:
lukew3 2021-06-01 12:00:23 -04:00
parent 0c514e5972
commit bcf81f87b4
3 changed files with 11 additions and 6 deletions

View file

@ -6,7 +6,6 @@
## Bugs
- Creating the first tag shows error "Unknown error, cannot read property \_id of undefined"
- Server side tagPb save overwrites same mode, different language/difficulty pb
- Leaderboard doesn't show the time until the daily reset
- lbmemory is not edited by mongo/express so it leaderboard doesn't show change in placement like it's supposed to
@ -30,6 +29,7 @@
- Name is not passed in user token/auth().currentUser
- Firestore read operations seem high
- Does this include index.html serving as well as user authentication or is there more?
- Account created on date doesn't look the same as it used to
### Possibilities

View file

@ -1228,11 +1228,16 @@ app.post("/api/addTag", authenticateToken, (req, res) => {
user.tags.push(tagObj);
user.save();
})
.then((updatedUser) => {
.then(() => {
console.log(`user ${req.uid} created a tag: ${req.body.tagName}`);
res.json({
resultCode: 1,
id: updatedUser.tags[updatedUser.tags.length - 1]._id,
let newTagId;
User.findOne({ uid: req.uid }, (err, user) => {
newTagId = user.tags[user.tags.length - 1]._id;
}).then(() => {
res.json({
resultCode: 1,
id: newTagId,
});
});
})
.catch((e) => {

View file

@ -77,7 +77,7 @@ function apply() {
Notifications.add("Tag added", 1, 2);
DB.getSnapshot().tags.push({
name: inputVal,
id: e.data.id,
_id: e.data.id,
});
ResultTagsPopup.updateButtons();
Settings.update();